How can I catalog the contents of a filesystem to a CSV file? This is particularly useful for removable media.
I've found a couple links that point in this direction:
Thank you!
How can I catalog the contents of a filesystem to a CSV file? This is particularly useful for removable media.
I've found a couple links that point in this direction:
Thank you!
This creates a CSV file listing.csv
with file name, time stamp and size for all files in /some/folder/
and its subfolders:
find /some/folder -printf '"%P";"%Tc";"%s";\n' > listing.csv
See the documentation for -printf
in the manpage for find if you want to use other fields.
Note that it doesn't work for file names containing "
characters.
If you need this to access the files on your external harddrive a better solution would be to create an index with extra options on updatedb
add this to your ~/.bashrc
:
alias updatedb-external='sudo updatedb -l 0 -o ~/.externalharddisk.db -U /media/path/to/harddrive/'
alias locate-external='locate -d ~/.externalharddisk.db:'
then you can query that list with that alias:
locate-external some-file
update your list with
updatedb-external
>
prompt when I run this command and I have toCtrl+c
to get out of it. What am I doing wrong? – Sean Fenton Aug 23 '13 at 11:25