LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   list then delete files in a directory with a specific date (https://www.linuxquestions.org/questions/linux-newbie-8/list-then-delete-files-in-a-directory-with-a-specific-date-929645/)

SparkyL 02-16-2012 03:26 AM

list then delete files in a directory with a specific date
 
I have a directory with files. I want to list all the files for a specific date then delete them... How do i go about doing this...?

vishnu_sreekumar 02-16-2012 05:04 AM

If my knowledge is correct, Linux filesystems doesn't store creation time. You can use -mtime (modification time), -atime (access time), -ctime (change time) flags of find command combined with the -exec flag to delete the files. A sample command to delete the files in a directory /testdir which were changed 2 days before would be
Quote:

find /testdir -type f -ctime 2 -exec rm -f {} \;


All times are GMT -5. The time now is 10:16 AM.