Saturday, May 18, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1339  / 3 Years ago, thu, june 17, 2021, 8:00:24

I have an external 1 TB hard drive with lots of media files (contained singly or in different folders), books, software etc. I would like to create a database file, maybe a spreadsheet file, which can show me a list of the files existing in the external drive. I would like to search through that file and find the media I was looking for even when the hard drive was not connected to the system.

In Windows 10 I use Easy Disk Catalog Maker for the job but I cannot find a similar software for Linux. So how do I go about it?

More From » files


If you just want a list of files, you can use a simple find, like @Raffa commented.

find /PATH/TO/EXTERNAL/HDD/ -type f -follow > "/PATH/TO/SAVE/file_list.txt"

If you want to save metadata information of your multimedia files, you can use mediainfo, that reads information for audio, video and picture files:

find /PATH/TO/EXTERNAL/HDD/ -type f -follow 
-exec mediainfo -f --Output=XML + > "/PATH/TO/SAVE/file_list.xml"

You can then read the output with any regular xml parser, e.g. xmlstarlet:

xmlstarlet sel -t -v '/Mediainfo/File/track/Complete_name' -n "/PATH/TO/SAVE/file_list.xml"

or e.g. search only images:

xmlstarlet sel -t 
-v '/Mediainfo/File/track[@type="Image"]/../track/Complete_name'

or find all images with file size > 1MB:

xmlstarlet sel -t 
-v '/Mediainfo/File/track[@type="Image"]/../track[@type="General"][File_size[1] > 1048576]/Complete_name'


sudo apt install mediainfo
sudo apt install xmlstarlet

[#2049] Friday, June 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 39
Total Questions: 106
Total Answers: 117

Location: Finland
Member since Sat, Dec 5, 2020
4 Years ago