[OT]: Ho wto find files created on a specific date

Todd Denniston Todd.Denniston at ssa.crane.navy.mil
Wed Apr 2 14:40:16 UTC 2008


Dan Track wrote, On 04/02/2008 10:05 AM:
> Hi
> 
> I need to delete files in my /opt/html/ directory that were
> created/modified ON the 20th of March this year? Is there a way for me
> to do this?
> 
> Thanks
> Dan
> 

an approximation, i.e., no guaranties, use at your own risk.
A few assumptions:
A) no files created/modified on the twentieth have been modified or touched 
since then.
B) nothing changed any of the time stamps on the files created/modified on the 
20th, i.e., no tar -x commands were used in /opt/html.


cd /tmp
touch --date="March 20" test20
touch --date="March 21" test21
find /opt/html/ -type f -newer test20 > list1
find /opt/html/ -type f -newer test21 > list2
diff -u list2 list1 |grep -e "^+\/"
diff -u list2 list1 |grep -e "^-\/"
now process one of those lists (I think the + list) and beware of spaces.
I would `ls -l --full` some of the files from the lists to figure out which one.

-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter




More information about the fedora-list mailing list