Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2001

    how do I remove files from certain date??

    I want to remove all files in a certain directory that has a file date of xx.xx.02, anyone know how I can do this on a mass level?


    rm -rf -d11.20.2001 *.* ??

    please help.. thanks

  2. #2
    Join Date
    Nov 2002
    Just curious, where did you get the -d option on the rm command? I didn't see it anywhere in the man pages.

    Here's something you can use-

    $ find . -name '*' -mtime n -exec rm {} \;

    The . represents the current directory and all sub-directories. If you have specific names for the files, you can stick that into the * part on the name option, otherwise just leave it as * and it'll look through all the files. mtime is the modication date, n is the number of days from the present date the file was modified. The -exec rm option will delete the file.

    Good thing to do would be to list the files first to make sure you're getting the right files with the n integer, and then delete them after you've made sure you got the right files.

    $ find . -name '*' -mtime n -print

    This will give you names and details of all the files modified on a certain date. The n is the tricky part.

    Once you've made sure you've got the right files, run the command from the top with the rm in it.

    Don't use it as is, play with it first. Let me know if you need help with the n part.

    Hope it helps.

Posting Permissions

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