Author Topic: Exporting metadat to XML/TXT single file  (Read 9013 times)

lmatias

  • Newbie
  • *
  • Posts: 4
Exporting metadat to XML/TXT single file
« on: February 02, 2011, 12:58:50 PM »
Hi everyone
I'm a newbie with ExifTool and would apreciate your help on the following problem.
I need to extract metadata from a large number of files (NEF and JPG) to a single XML file or a TXT file to process in a database.
Is this possible to do with ExifTool?
One example is to extract FileName; Orientation; DateTimeOriginal; FocalLenght and FocalLenght35mm to a single XML file with TAGs and/or TXT file with Comma Separated Values (first line with Tag names, CSV too)
I already tried the command lines:
exiftool -T -k  -aperture -createdate -shutterspeed -iso f:\Guida\*.jpg > out.txt
and
exiftool -T -k  -aperture -createdate -shutterspeed -iso f:\Guida\*.jpg > f:\Guida\out.txt

and the files are processed but the error messages:
"Error opening directory"
"File not found: out.txt"

are always displayed.

To the XML format I don't know how the command line is. If that is possible...

Thanks

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11679
    • ExifTool Home Page
Re: Exporting metadat to XML/TXT single file
« Reply #1 on: February 02, 2011, 01:11:25 PM »
The command for XML output is

exiftool -X DIR > out.xml

I don't understand why you are getting the errors.  What system are you using?

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

lmatias

  • Newbie
  • *
  • Posts: 4
Re: Exporting metadat to XML/TXT single file
« Reply #2 on: February 03, 2011, 05:40:35 AM »
I'm using Windows XP Professional SP3

When you say DIR it means the full path to the directory where the image files are, wright?
If we don't indicate no path on the "out.txt"  or "out.xml" where is the file placed?

With the command line
exiftool -T -k  -aperture -createdate -shutterspeed -iso D:/Arquivo/Fotos > D:/Arquivo/Fotos/out.txt

I obtain the result I append for six example .jpg files

Thanks
Luis

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11679
    • ExifTool Home Page
Re: Exporting metadat to XML/TXT single file
« Reply #3 on: February 03, 2011, 07:40:19 AM »
Hi Luis,

Directories and file names may be specified either with a full path, or relative to the current working directory.  When you don't specify a directory for a file, it is placed in the current working directory (which you can see by typing "pwd" at the command line).

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

lmatias

  • Newbie
  • *
  • Posts: 4
Re: Exporting metadat to XML/TXT single file
« Reply #4 on: February 03, 2011, 08:01:15 AM »
Hello Phil

About the error I get can you help me?
What am I doing wrongly?
I have the exiftool.exe file on the Windows directory.
I will try in another computer also but only later at night.

Ciao
Luis

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11679
    • ExifTool Home Page
Re: Exporting metadat to XML/TXT single file
« Reply #5 on: February 03, 2011, 08:04:32 AM »
Hi Luis,

About the error:  It looks like either you are putting quotes around the redirection symbol (">"), which would be wrong, or you are not using an ASCII greater-than symbol.  If you have an international keyword, could it be that you are using some similar-looking character?

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

lmatias

  • Newbie
  • *
  • Posts: 4
Re: Exporting metadat to XML/TXT single file
« Reply #6 on: February 03, 2011, 09:49:03 AM »
Hello Phil

I discouvered what I was doing wrong.
I was running the command line to Exiftool with Windows Execute (from the Start Menu).
I opened a DOS/Command window and the Exiftool command line worked immediately.

So thanks. I'm ready to do hat I need with your software.

Kindely
Luis Matias

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11679
    • ExifTool Home Page
Re: Exporting metadat to XML/TXT single file
« Reply #7 on: February 03, 2011, 11:10:20 AM »
Hi Luis,

I'm glad you figured this out because I wouldn't have thought of this.  It is the cmd shell that does the redirection, so this makes sense.  If you run directly from the "Run..." menu you bypass the cmd processor.

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

Bluegum

  • Newbie
  • *
  • Posts: 2
Re: Exporting metadat to XML/TXT single file
« Reply #8 on: January 11, 2012, 06:52:47 PM »
I seem to be having a similar problem with a Windows shortcut (Windows 7 Enterprise). 

The target I am using is C:\Users\me\exiftool-8.75\exiftool.exe -a -csv *.jpg > out.csv which works fine from a command prompt, but with the windows shortcut the redirect > seems to be interpreted as a parameter, giving the error message Error opening directory >.

Can you confirm that the problem is with the cmd processor (or lack of), or am I missing something?

Nick

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 11679
    • ExifTool Home Page
Re: Exporting metadat to XML/TXT single file
« Reply #9 on: January 11, 2012, 07:30:59 PM »
Hi Nick,

You can't use special shell characters like ">" in a shortcut.

Instead, make a simple .bat file:

Code: [Select]
C:\Users\me\exiftool-8.75\exiftool.exe -a -csv %* > out.csv
Then drop the JPEG images on this .bat file.

I notice that you put "*.jpg" in your shortcut target.  This also won't work.  Above I assumed you want to drop the files on the .bat file, but if you don't then replace "%*" with "*.jpg".  If you do this, then clicking on the .bat file will run exiftool on a JPG files in the working directory (your home directory by default?).  I think you can set the working directory in the Properties of the .bat file if you want.  Also, "out.csv" will be created in the working directory unless you add a directory to the name.

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

Bluegum

  • Newbie
  • *
  • Posts: 2
Re: Exporting metadat to XML/TXT single file
« Reply #10 on: January 11, 2012, 09:10:53 PM »
Thanks Phil,

I'd started going down the batch path and with your suggestions have got a more flexible result that does what I want ie provide a list of tags I can use to help eliminate duplicate files in our 100,000+ photo library.

Still a long way to go though  :D

Thanks again.

Nick