Загрузка страницы

Advanced Shell Scripting Tutorial | Delete More Than X Days Directories | Tech ArkIT

Advanced Shell Scripting Tutorial - Scenario: Everyday from Monday to Friday one directory will be created under /fullbackup/dailybackup/YYYY-MM-DD and it will move backup to its parent directory everyday midnight /fullbackup/archive/, However Saturday, Sunday and Monday directories will move to /fullbackup/archive path every Monday evening.

Directory Names Example: 2018-12-24 2018-12-25 2018-12-26 2018-12-27 2018-12-28

Question: I would like to delete directories older than two days from /fullbackup/archive path. How do you do it using any scripting methods.

Problem Statement: I was trying to use
find /path/ -type d -mtime +2 -print0 | xargs -r0 rm -- .
This command does not work as expected due to directory modified date for SAT, SUN and MON are Mondays date.

How Do you solve it.?? Write Shell Script or Any other script to accomplish this task.Should run through Crontab and clear directories older than two days.

https://www.modicare.com/becomeConsultant.aspx?kk07jit=c54083f23d7b6cd449024ab4dbcd9e34

Scripts: https://github.com/techarkit/shell-scripting-tutorial

http://bit.ly/AIMLEdgree Artificial intelligent 90% Discount
http://bit.ly/MLAIEdgree Machine Learning 85% Discount
http://bit.ly/FullStackEDgree 95% Discount Using this Link
http://bit.ly/devopsedgree 80% Discount using this Link
http://bit.ly/DataScienceEDgree 90% Discount using this Link

RHEL5AND6: https://ark-library.blogspot.com/p/index.html

Follow Us on Social Media
WhatsApp Group: https://github.com/techarkit/TechArkit-YouTube/blob/master/whatsapp_group.md
Join Telegram Group: http://t.me/linuxarkit 3000 Members Joined
Github: https://github.com/techarkit/
Facebook: https://www.facebook.com/linuxarkit
Twitter: https://twitter.com/aravikumar48
Instagram: https://www.instagram.com/arkit.co.in/
Website: https://arkit.co.in
Reddit: https://www.reddit.com/r/techtutorial/
Email: aravikumar48[at]gmail.com

Post your topic, we will make videos for you
https://forms.gle/M4ysoMNh1zsPXiw89

#Techarkit #shell #scripting

Видео Advanced Shell Scripting Tutorial | Delete More Than X Days Directories | Tech ArkIT канала Tech Arkit
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
1 января 2019 г. 16:17:08
00:19:07
Яндекс.Метрика