Need Help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Help
# 1  
Old 11-05-2008
Need Help

Hi

Please help in writing shell script for removing the 60 days older files. and if the files are not 60 days older then they should be zipped and zipped files are to be move to the seperate directory.

Thanks in advance.
# 2  
Old 11-05-2008
Look into the man page for "find", especially the switch "-mtime"; experiment with the find command.
# 3  
Old 11-07-2008
#To purge the files which are older than 60 days
find [dir] -name [file] -mtime +60 -exec rm -rf {} \;

#gzipping the old Hi*.txt files
for i in `find [dir] -name [file] -mtime +59`
do
gzip $i
#write move cmd here: mv [source dir] [target dir]
done

#Please test the code before you implement.

Thanks
Sarwan
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question