Delete files by date

Hello,

Due to an error while processing data I have to delete all files created the 4 october on a RED HAT 3 Server.

I am wondering if one of you is aware of a command that could only delete all files that were created the

 Oct  4 

This will be very, very, very helpful

Thanks for your help.

Maybe something like this:

ls -lrt | awk '/Oct 4/ {print $NF}' | xargs echo rm -rf

The cabrao statement suppose that none of your file created on the 4 Oct has been modified a further day :
ls -lrt would display last modification date, not the creation date ...

Dear Cabrao,

Sorry this deosn't work for me. The result does not match with the number of files that I should delete.

Thanks anyway for your help.

I didn't read the part saying "..files created..." sorry.

I don't know how to do it and according to the UNIX FAQ, it is not possible to see the file creation time.

Files have a last-modified time (shown by "ls -l"), a last-accessed time (shown by "ls -lu") and an inode change time (shown by "ls -lc").

http://www.faqs.org/faqs/unix-faq/faq/part3/section-1.html
1 Like

Thanks for your help ... I will try to do it manually ... :frowning:

But thanks for your help :wink:

ls -lrt | awk '/Oct 4/ {print $NF}' |\

while read filename; do
echo "File getting deleted is --> ${filename}"
rm -f "${filename}"
done;

You can put the above code in the script and run it to delete the files.