I need to get the file information (name, size, date modified) of about 1M+ files on a system. The command I am currently using is:
sudo find "$FULFILLMENT" "$ARCH1" "$ARCH2" "$MASTERING" -type f -exec ls -lT {} +
Is there a way to improve this? The only requirement is I must get all the files in the above volumes and for each file, pull the name, size, and date_modified.
(Is there a way to do a stat command here instead? Would that speed things up?)
This takes about an hour on a fiber connected machine.
Instead of farming the printing out to
ls
, you can usefind
's built-in printing:I'm not sure how much faster that'll be, but it saves the forking out to
ls
, and it saves having to consult the disk a second time to retrieve information vials
thatfind
already has anyway, so it should be at least somewhat faster.(By the way, you can search
man find
for-printf
for more information on those format strings. In particular, you can customize the presentation of the last-modified-time, and you can specify explicit field-widths for the other fields.)