Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-16-2012, 03:26 AM   #1
LQ Newbie
Registered: Feb 2012
Location: South Africa, Gauteng, Johannesburg
Posts: 1

Rep: Reputation: Disabled
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...?
Old 02-16-2012, 05:04 AM   #2
Registered: Jan 2006
Location: India
Distribution: Ubuntu, RHEL, Debian
Posts: 49

Rep: Reputation: 20
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
find /testdir -type f -ctime 2 -exec rm -f {} \;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete/move/copy files of specific date imsajjadali Red Hat 26 11-07-2013 11:34 PM
[SOLVED] List specific files and delete results niiiro Programming 2 07-08-2011 09:08 AM
Delete all files of certain date. fatz2000 Programming 2 12-22-2009 09:06 AM
ow do I delete all files which were created on a specific date marsguy Linux - General 9 08-21-2007 08:15 AM
Copying files from a specific date dman65 Linux - Software 3 09-22-2003 10:16 AM

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration