Creating a directory listing of files

Started by Kanyimbe, August 23, 2010, 04:11:03 AM

Previous topic - Next topic

Kanyimbe

I've been working on this concept for creating an enriched directory of files. I've been finding the exiftool could work great for this.

exiftool(-k -w .txt -Title -Subject -Author -PageCount -FileSize)

For example this code for PDFs gives some useful info for each file.

My idea has been to have exiftool reside in a directory and when the index.htm file is opened, the directory listing will be updated with the latest content and its metadata complete with links to the prospective files.

The thing I haven't figured out is:

How to dump the contents into an index.html file template (body, html etc)?

Thanks for any ideas.

D

Phil Harvey

You can output metadata in any format you want with the -p option.  See the Reverse Geotagging documentation for some examples of -p format files.  You should be able to use this to do exactly what you want.

Also, there is a -h option which formats output in HTML table form, but you would have to handle the HTML header/footer if you use this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Kanyimbe

Thanks,

Sorry to sound like a n00b but I haven't figured out how to output to a file because when I use > Windows XP says that's not valid in the filename. How does that work?

Phil Harvey

The command-line redirection ">" can't be done by putting options in the "exiftool(-k).exe" file name as you have discovered.

You can either run cmd.exe and type in the command, or make a batch (.BAT) file with the command you want to run.  With the batch file you can drag and drop if that is what you want.

The .BAT file will have a command something like this:

exiftool -p "c:\my files\my_format.fmt" %* > "c:\my files\my_output_file.txt"

Then when you drag and drop files and folders on the .BAT file, you will get an output file with the results.  The %* in the above command will be replaced by the name of all files/folders you drop on the .BAT file.  For the above command to work, "exiftool.exe" must exist somewhere in the PATH.  See the Windows install instructions for command-line use if you need help with this.

If you run into any troubles, let me know.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Kanyimbe

Thanks so much for this info (which I've forwarded to the guy that is now helping me)! I'm really excited about the potential of this tool.

Kanyimbe

Just thought I'd add here that I've recently made some progress on this thanks to the good advice about using FMT. You can see my post here: http://kanyimbe.posterous.com/ubiqivos-come-back-to-haunt-us

Thanks, a lot.

Phil Harvey

Thanks for the link.  One minor correction to your blog: ExifTool is Perl, not Python.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).