Home rotation of file in shell script
Reply: 0

rotation of file in shell script

user889
1#
user889 Published in May 21, 2018, 11:18 am

I need to write rotation of files shell script. I have following format data in a target directory(/backup/store_id/dates_folders)

Like :

cd /backup/

drwxr-xr-x 5 root root 4096 Mar 25 12:30 44

drwxr-xr-x 3 root root 4096 Mar 25 12:30 45

drwxr-xr-x 4 root root 4096 Mar 25 12:30 48

drwxr-xr-x 3 root root 4096 Mar 25 12:30 49

cd /backup/44/

drwxr-xr-x 2 root root 4096 Mar 25 12:30 22032014

drwxr-xr-x 2 root root 4096 Mar 25 12:30 23032014

drwxr-xr-x 2 root root 4096 Mar 25 12:30 24032014

drwxr-xr-x 2 root root 4096 Mar 25 12:30 25032014

now 44 (store_id) contain four dates folders. I want each store_id( like 44 folder) contain only three recent dates folder like 23,24,25 & 22 should be deleted. Please help me how to write in shell script. Please give me some hint

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.391979 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO