Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 2 of 2

This is a discussion on Script to remove files/dirs based on timestamp in the Shared & Semi-Dedicated forum
Hey - I just finished building myself a nice little auto-backup shells script using a few other threads from this forum . The resultant backup ...

  1. #1
    JPC Member
    Join Date
    Jul 2002
    Posts
    47

    Script to remove files/dirs based on timestamp

    Hey -

    I just finished building myself a nice little auto-backup shells script using a few other threads from this forum . The resultant backup files are stored in my account directory (as opposed to ftp'ed or ssh'ed to another box).

    What I'd like to do is add additional commands to the script so that it removes the backup directories who have a timestamp that's past a certain date. In a nutshell, date-based pruning. Unfortunately, I'm not a *nix person, so I have no idea where to begin (or to start looking up stuff online )

    It'll essentially be a list of directories (with the backed up files inside), and I need to remove the whole directories if they are..say...1 month old.

    Thanks in advance!

    (ps: I have no doubts I could whip together a php script to handle this, but I'd prefer the simplicity of keeping all backup related info in a single .sh script)

  2. #2
    Jag Veteran
    Join Date
    Sep 2002
    Posts
    650
    Hello,
    If you want to remove a directory with all the files and subdirectories inside, just use
    /bin/rm -rf <directory>
    where <directory> can be absolute or relative path to the directory you want to delete.
    Be very careful with that command, though

Bookmarks

Posting Permissions

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