Purging logic


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Purging logic
# 1  
Old 07-15-2013
Purging logic

Hi guys i am having following files in a directory
Code:
 
a_07:15:13.txt
a_07:16:13.txt
a_07:17:13.txt
a_07:18:13.txt
a_07:19:13.txt

a_date file will be created on a day to day basics so that it may pileup on a long go.So i need to create a logic so that the files will be gunzipped to a backup directory.If i run the prog by Aug 6 am Ct then it should contain the files of July month.these files are saved under the dir of july month.i need to create directory dynamically
for e.x
Code:
home_dir/jhon/a_2013/

under this i ll have all the files of as /Jan
/Feb and so on.
Code:
 
/home_dir/jhon/2014/

under this i ll have all the files of as /
Code:
 
/Jan
/Feb and so on

# 2  
Old 07-15-2013
Have a look at the "find" commands man page. It does what you want. Examples on how to use "find" can be found in this forum in abundance.

I hope this helps.

bakunin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

purging of Files

Hello All, I want to delete the files based on the days. like, Files available under directory /abc want to delete if they are older than 15 days. Files available under directory /pqr want to delete if they are 7 days old and some files under directory /xyz should get deleted if they are... (5 Replies)
Discussion started by: ssachins
5 Replies

2. Shell Programming and Scripting

Purging script

Hi, Need to change the following command to also purge the child directories after /data/tmp within one command (recursively check for X number of days old files and purge accordingly)? e.g. /data/tmp/a, /data/tmp/a/b, /data/tmp/log. find /data/tmp -type f -mtime +7 -exec rm -f {} \; ... (2 Replies)
Discussion started by: egls
2 Replies
Login or Register to Ask a Question