treds
December 28, 2014, 8:11pm
1
Hi
i am looking to expand a command i am using to find files in a large file system.
i am currently using
find /raid/JOBFLOW_LOCKED/ -type f -size +3G | -exec mv {} /raid/JOBFLOW_LOCKED/KILL \;
This works really well but i would like to add a date range to the same command to refine it further, example:finding files between 21-04-2014 to 26-08-2014
Can some one please assist me in this.
Thanks in advance
Treds
touch -t 201404210000 stime
touch -t 201408270000 etime
find /raid/JOBFLOW_LOCKED/ -type f -newer stime ! -newer etime -size +3G -exec mv {} /raid/JOBFLOW_LOCKED/KILL \;
This will remove the files that were modified between 2014-04-21 through the end of 2014-08-26
RudiC
December 29, 2014, 4:59am
3
on Red Hat, you probably have find (GNU findutils) 4.4.2
(or some other major/minor version), which should provide the -newerXY
test. Try -newermt
.
treds
December 30, 2014, 2:02pm
4
hi derek
probably doing this wrong but don't seem to be able to get this to run.
Was not sure if i had to run the touch commands first then run the move or put all the entries into a shell script and run as one. I modified a few of the entries to ensure data was being picked up.
touch -t 201401210000 stime
touch -t 201404270000 etime
find /raid/JOBFLOW_LOCKED/ -type f -newer stime ! -newer etime -size +50M -exec mv {} /raid/JOBFLOW_LOCKED/KILL \;
all that seems to happen is i end up with the 2 touch files and nothing gets moved.
thanks
Treds
RudiC
December 30, 2014, 2:36pm
5
Why don't you list the files before trying to move them? And, make sure there's at least one file fulfilling the conditions.
treds
December 30, 2014, 6:19pm
6
Hi Rudi
please excuse my lack of knowledge but what would i add to the command to see the list, i tried adding print but that did not work
find /raid/JOBFLOW_LOCKED/ -type f -newer stime ! -newer etime -size +50M
Regards
Treds
RudiC
December 31, 2014, 4:48am
7
Just run it as posted; it will list the candidate names.