The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-02-2008
ramu_indian ramu_indian is offline
Registered User
 

Join Date: May 2008
Posts: 5
Deleteing archived files

Hi,

I need to remove files that are in archive directory and which are old. I can make use of find command to search for files which are older by number of days.

But the problem is there are sub directories in directory 'archive' like 'sub1' 'sub2' 'sub3'.

Now all files which are in 'archive/sub1' should be deleted if they are old by 30 days.
All files which are in 'archive/sub2' should be deleted if they are old by 90 days.
Now all files which are in 'archive/sub3' should be deleted if they are old by 120 days.
If the files are in 'archive/' then they should be deleted if they are older by 365 days.

I want to create a properties file like

Code:
#archive policy
# foldername=<period-in-days>
archive/sub1=30
archive/sub2=90
archive/sub3=120
default = 365
and I want to write a shell script that reads location from above file to know the period of days.

Can any one give me a push! :-)
Reply With Quote
Forum Sponsor