Find the answer to your Linux question:
Results 1 to 2 of 2
hi there, i am looking for some sample shell scripts where i could run this shell scipt after my backups are done and are lying in the directory. what i ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    1

    shell script [debian]

    hi there,
    i am looking for some sample shell scripts where i could run this shell scipt after my backups are done and are lying in the directory.
    what i want to accomplish is:
    to run the script after the backups are done and to delete the past tar files according to the following:
    it shud delete any one file from last year
    one a month in quarter
    one a week
    one per day for current week...

    so that we dont have to manually delete those file all the time.i want to autmoate the process.

    please help!!!

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Try the -mtime option of find:

    Code:
    find <directory> -mtime n -exec rm -f {} \;
    Read the man page of the find command.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...