shell - On Linux, FIND command with LS not showing proper result without option -d -
i need check files created in last day inside current folder has million of files.
if used following command correct 80 or 90 files shown. correct.
find . -ctime -1 -exec ls -ld {} \; but if change ls option rt or l or else without d. shows wrong result. shows thousands of file. have press control c stop output. following wrong never ending results.
find . -ctime -1 -exec ls -l {} \; find . -ctime -1 -exec ls -t {} \; find . -ctime -1 -exec ls -rt {} \; find . -ctime -1 -exec ls {} \; can tell going on here. why works d. following works though
find . -ctime -1 -exec ls -lrtd {} \;
if ls /tmp, you'll see why. gives files in /tmp directory rather details on directory itself.
you can 'fix' using -d have ls show directory rather files within (as you've seen) or using find -type f restrict search regular files only. that's assuming it's regular files you're interested in, there things fifo pipes , devices exist in hierarchy, there other variations on -type pick if needed (see find man page details).
Comments
Post a Comment