News:

2023-08-10 - ExifTool version 12.65 released

Main Menu

What are these called?

Started by terrypin, March 19, 2013, 10:38:13 AM

Previous topic - Next topic

terrypin

I'm making progress but still have several mental blocks. Here's one.



The context is that I'm trying to add 'Folder' or 'Directory' to the GUI Workspace, as an important filed for managing my photo comments. So far I haven't worked out how to do that.

Also, Directory is included under the 'All' tab, so I don't understand why it has no entry?




--
Terry, East Grinstead, UK

Phil Harvey

Hi Terry,

In the list of tag tables, you need to click on "EXIF" to see the EXIF tag names (UserComment, Artist, etc...).  Tags in the "File" group are in the Extra Tags documentation.

If "Directory" is ".", then ExifToolGUI must be changing the current working directory to the selected directory.  ("." represents the current working directory.)  I was afraid of this, because if this is true there will be no way to get the directory name in your output text file via ExifToolGUI.

- Phil

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

terrypin

Hi Phil,

Thanks, understood - duh!

OK, that would rule out the GUI. But is that also true of ExifTool? On that Extra Tags documentation page I found this entry:


Tag Name    Writable    Group Values / Notes
Directory Y! System (may be written to move the file to a specified directory. New directories are created as necessary)


I want to use it to uniquely identify the photo. And write it to ThisPhoto.TXT and ThisFolder.TXT, containing Comment and Date/Time data, for the photo or the folder of them respectively.  So that it can be used to restore those fields when they are subsequently destroyed. I'll spell this out more clearly in a day or so, but that's the general drift.


--
Terry, East Grinstead, UK

Phil Harvey

Hi Terry,

Yes, this will work via the command line.

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

terrypin

Thanks Phil, but you're way ahead of me! What exactly will work? Can you give me a simple example to try please?

--
Terry, East Grinstead, UK

Phil Harvey

Maybe something like this is what you want:

exiftool -T -directory -filename -datetimeoriginal -comment -r c:\images > out.txt

(here I use c:\images as an example directory name)

This command will produce a file called out.txt in the current directory.  The file will contain a tab-delimited list of the directory, filename, datetimeoriginal and comment from each image that exiftool finds.  The -r option causes ExifTool to also search sub-directories.

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

terrypin

Thanks Phil, but I couldn't get that working.

The first 5 of these which I created earlier as part of my learning, all work as expected. But the last very briefly opens a Command Prompt window, writes some lines, then closes, without creating any output file. Can you see what's wrong please? The folder c:\images contains 11 JPGS, like those I used in my earlier tests.

Name           Windows shortcut
------------   ---------------------------------------
Copy to EXIF   C:\WINDOWS\exiftool.exe -k -o %d%f.exif
Copy to MIE    C:\WINDOWS\exiftool.exe -k -o %d%f.mie
Copy to XMP    C:\WINDOWS\exiftool.exe -k -o %d%f.xmp
Display All    C:\WINDOWS\exiftool.exe -k
Write TXT      C:\WINDOWS\exiftool.exe -a -u -g1 -w txt
From PH - 1    C:\WINDOWS\exiftool.exe -T -directory -filename -datetimeoriginal -comment -r c:\images > out.txt


In case it helps, here's the folder: https://dl.dropbox.com/u/4019461/images.zip

--
Terry, East Grinstead, UK

Tarn

Hi Phil, and Terry

I don't use the GUI that much, so I'm not sure. But in the command line version does the same thing; it shows a dot to represent the current directory. By simply backing up one directory will cause the output to list the directory names, instead of just a dot. But you have to recurse into lower directories for this to work. I'm not sure if the GUI can list files that are in subdirectories or not.

Not sure if this helps you or not.

Tarn

Quote from: terrypin on March 19, 2013, 04:41:28 PM

From PH - 1    C:\WINDOWS\exiftool.exe -T -directory -filename -datetimeoriginal -comment -r c:\images > out.txt
[/code]
Try : > c:\images\out.txt

From PH - 1    C:\WINDOWS\exiftool.exe -T -directory -filename -datetimeoriginal -comment -r > c:\images\out.txt


--
Terry, East Grinstead, UK

terrypin

Hi Tarn,

Thanks, but that alternative failed too.

--
Terry, East Grinstead, UK

Phil Harvey

Hi Terry,

How did you run this command?  It will only work if you type it in a cmd.exe window, in which case the window shouldn't close afterwards.  The redirection to an output file ">" won't work in the Target properties of a shortcut.  If you want to do this with drag-and-drop functionality, it may be done in a .BAT file, but I don't want to overload you with that concept right now.

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

terrypin

#11
Hi Phil,

This is the way I really like to learn! I'm now looking forward to solving this little puzzle...  ;)

I've tried it all 3 ways. From what you said I now realise it shouldn't work via drag and drop. But I don't yet see what's preventing it working from either the Run box or Command Prompt. (BTW, should I focus exclusively on the latter? Or should both give identical results?)



Edit: Sorted! 5 minutes later I thought I'd try changing the directory in the Command Prompt before running the command. Something you no doubt thought was obvious, yes? And I'm delighted to find that it worked. Fast and silently too.

It's a while since I wrote any batch files but can you help me find a more robust way of running this command, Phil?

Typically, I'd want to do so with the target folder open. I'd be browsing its photos and adding new comments if necessary or editing those previously made. Carefully avoiding opening it in the dreaded PaintShop Pro, even though sorely tempted because of obvious necessary editing. And as soon as possible I'd want to generate this text output as security against future loss. I could do it if I spend an hour or two writing a macro to effectively emulate all key and mouse activity to do what i've just done. But I'm sure there's a far simpler approach?

I'd also appreciate your briefly explaining why a change of directory was necessary in this case please. The command includes explicit absolute paths. And changing directory wasn't necessary in the earlier examples you gave me. I just opened a Command Prompt as instructed (which always comes up in C:\Documents and Settings\Terry) and pasted or typed the command given.

--
Terry, East Grinstead, UK

Tarn

Terry,

Quote from: terrypin on March 19, 2013, 06:15:34 PM
Hi Tarn,

Thanks, but that alternative failed too.

--
Terry, East Grinstead, UK
Oops! My bad. I overlooked that you don't have a file, or directory specified to work on. Add a file name, a dot ".", an asterisk "*", or a directory name.

exiftool -T -directory -filename -datetimeoriginal -comment -r . > u:\images\out.txt
Works for me.                                                                                         ^

Look at the cut and paste from when I did this. The only difference is I'm working on drive U instead of C.


U:\images>exiftool -T -directory -filename -datetimeoriginal -comment -r > u:\images\out.txt
No file specified

U:\images>exiftool -T -directory -filename -datetimeoriginal -comment -r .
.       a.jpg   -       a.jpg   a.jpg   -
.       b.jpg   -       b.jpg   b.jpg   -
.       c.jpg   -       c.jpg   c.jpg   -
.       image.jpg       2011:07:27 06:56:52     image.jpg       110727-9676.psd -

U:\images>exiftool -T -directory -filename -datetimeoriginal -comment -r . > u:\images\out.txt

U:\images>type out.txt
.       a.jpg   -       a.jpg   a.jpg   -
.       b.jpg   -       b.jpg   b.jpg   -
.       c.jpg   -       c.jpg   c.jpg   -
.       image.jpg       2011:07:27 06:56:52     image.jpg       110727-9676.psd -

U:\images>

If you notice, my first attempt returned the error of "No file specified". That is where adding the dot "." just after the -r option comes in. The dot means all files in the current directory.

The second try, I added the dot, and took out the redirect in order to see the results on the screen. It worked, so I added the redirect back in and it created out.txt. Which I "typed" to the screen.

Hope this helps.

terrypin

Hi Tarn,

Thanks a lot! I'll try your version in a  minute. Looks like our posts crossed in the electrionic ether. As you see from my Edit, I got it working by changing the directory. Not clear why I had to, but that's because I'm not a DOS/Command/Batch/Programmer techie.  ;)

Much appreciate your help.

--
Terry Pinnell, East Grinstead, UK

Tarn

Hi Terry,

I cut my teeth on CP/M (before DOS), so the Dos prompt is familiar to me.
The first thing I would suggest is that you try typing just "Exiftool", without the path and without the dot exe on the end. If you have exiftool.exe in your "C:\Windows" directory, you should be able to call the program from anywhere on your computer.

Next, type "Help" at the dos prompt. This will list all dos commands, and what they do.

You might find it easier to work in your images directory rather than your Documents and settings directory. Type CD \images and press enter, or return. That should take you into the "C:\images" directory. Also, type "CD /?" and it will list all the info on that command.

Batch files, or the most part, are nothing more than typing your commands into a text file that ends in ".bat".  In fact, I'll use your example, as an example.

Create a text file in Notepad, or better yet Notepad++. Type in:
exiftool -T -directory -filename -datetimeoriginal -comment -r . > u:\images\out.txt
and then save it as "out.txt" in either your images directory, or in your windows directory.

Then simply type "out" at the dos prompt and you will see it echoed to the screen and acted on as if you had typed it.

Another tip: The single greater than sign ">" will create out.txt if it does not exist, or overwrite it if it does. Either way, new file every time. Use two gt signs ">>" and it will create out.txt if it does not exist, and append to it if it does.

That should get you going. Remember: "Help" gets you all the commands; any command followed by forward slant question mark "/?" gets you help with that command. Don't let the verbiage scare you, the dos commands are really quit intuitive.

Actually, you should be able to enter all of your lines into one batch file and have them work. Enter each line the same way as my example, on a separate line.  Each command line will execute as soon as the previous one is done processing. If you need it to stop while you look at something, enter "pause" on it's own line, in between the command lines.

This may sound confusing right now. But it really is simple. I just takes a little getting used to is all. You need to make a few mistakes so you can see how not to do it; just as much as you need to get it right. :)

Give a holler if you need more help.

Phil Harvey

Terry,

I'm confused about why you said it didn't work.

When you ran the command, the current working directory was "C:\Documents and Settings\Terry", so this is where "out.txt" will be written (since you didn't specify a directory for out.txt).

Since you specified a directory for the images ("C:\images"), the current working directory doesn't come into play for locating the images.

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

terrypin

Hi Tarn,

Excellent help, thanks a bunch! Really appreciate your taking the time.

I'll try your suggestions later today, with an easily run batch program to produce that text file as my practical objective. And some solid learning as I go!

I wonder if you saw the earlier discussion I had with Phil in the thread https://exiftool.org/forum/index.php/topic,4881.0.html
about one flaw with the output, namely its reversal of the path separators?

IOW, from the correct
C:\Docs\My Pictures\PHOTOS\Walks UK\TP04\TP04-All\Tests\20040817-103458.JPG
to the incorrect
C:/Docs/My Pictures/PHOTOS/Walks UK/TP04/TP04-All/Tests/20040817-103458.JPG

It's easily fixed in my text editor with a global change, of course, but do you know if there's a way to do it within the ExifTool commands?

--
Terry, East Grinstead, UK

terrypin

Quote from: Phil Harvey on March 20, 2013, 07:59:06 AM
Terry,

I'm confused about why you said it didn't work.

When you ran the command, the current working directory was "C:\Documents and Settings\Terry", so this is where "out.txt" will be written (since you didn't specify a directory for out.txt).

Since you specified a directory for the images ("C:\images"), the current working directory doesn't come into play for locating the images.

Hi Phil,

Did you miss my Edit?

You underestimated my rustiness with the use of DOS commands! Largely why I installed the GUI, remember?  :)

But as you see from that Edit, the penny dropped a few minutes later and then your command worked fine.

I also had a variation from Tarn which I'm about to try.

One thing (of several!) that's confusing me a bit. Is this 'redirect' method using the '>' equivalent to using '-w txt' as in the command discussed in an earlier post of of mine:
"....drag a file containing EXIF data onto the executable exiftool(-a -u -g1 -w txt).exe  and "...a TXT file will be silently written in the original folder, containing all EXIF/Comment data"?

As per my post to Tarn a few minutes ago, my focus now is on getting a batch file that will produce this text file (preferably with correct backslash path seperators).

Must say I was very impressed with the speed. It was only a small folder of 11 files, but my macro approach takes several seconds, with a lot of annoying screen activity.

--
Terry, East Grinstead, UK

Phil Harvey

Hi Terry,

Yes, I read your edit, but I was still confused.  If you aren't confused then that's all that matters.

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

terrypin

Quote from: Phil Harvey on March 20, 2013, 11:48:30 AM
If you aren't confused then that's all that matters.

Well, not sure about that! For example, any advice on my question about -w?

--
Terry, East Grinstead, UK

Phil Harvey

Quote from: terrypin on March 20, 2013, 11:51:16 AM
Well, not sure about that! For example, any advice on my question about -w?

">" writes to a single output file for the entire command.

-w writes to a different output file for each input file.

-W (capital) writes to a different output file for each tag.

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

Tarn

Hi Terry,

Quote from: terrypin on March 20, 2013, 10:52:39 AM
Hi Tarn,

Excellent help, thanks a bunch! Really appreciate your taking the time.

I'll try your suggestions later today, with an easily run batch program to produce that text file as my practical objective. And some solid learning as I go!

I wonder if you saw the earlier discussion I had with Phil in the thread https://exiftool.org/forum/index.php/topic,4881.0.html
about one flaw with the output, namely its reversal of the path separators?

IOW, from the correct
C:\Docs\My Pictures\PHOTOS\Walks UK\TP04\TP04-All\Tests\20040817-103458.JPG
to the incorrect
C:/Docs/My Pictures/PHOTOS/Walks UK/TP04/TP04-All/Tests/20040817-103458.JPG

It's easily fixed in my text editor with a global change, of course, but do you know if there's a way to do it within the ExifTool commands?

Glad that my rambling helped. I did see, read, and learn from that topic. And, although I haven't attempted it yet, I would say that Phil's solution would be the best one. Definitely better than one I could offer.

As for changing the slash character in the output... I'm at a loss. I'm certain that there might be a way to (maybe) do it; unless I'm wrong. But that would be best asked of Phil. On a side note, may I ask why you want to change them in the first place? I'm going to guess that you are trying to generate output for a website(?).

Let me say something that might help you understand the redirect a little more. The redirect is nothing more than turning your screen off and your file on. Simply put the ">" sends anything that would have shown up on your screen, to the file you specify (out.txt in this case). Also, this happens outside of your command; meaning that it has nothing to do with the command itself; only the output of the command. There is nothing more to it. Screen=Off,out.txt=On. Once the command has finished, output returns to the screen.

The -w, and -W options act from within the command, as part of the command. While all three may produce similar output, it is how they produce that output that matters. At this point, I am not familiar enough with the -w and -W options to give you a good answer. All I know is that the -w, and -W options will generate output to a file as part of the command. > will send all output from the screen to a file.

Also, a little note about "DOS", or "The Command Line", or "running CMD"; You (probably) think that running CMD is running a program from within windows. (Here is where I'm going to catch some flack) It's not! Windows is nothing more than a fancy, very fancy, way of issuing DOS commands. And while Windows is called the operating system, it still boils down to the fact that Windows provides an easy way to issue DOS commands. Typing "dir" at the Dos prompt, and clicking on Windows explorer do the exact same thing; they list the files in a directory. Double clicking on the "images" folder in your explorer window does the exact same thing as typing "CD images" at the Dos prompt. That's all there is to it. So set any fears you may have aside and relax. In my humble opinion, DOS is still the most powerful way to manipulate files. More cumbersome due to the typing, but much more powerful.

All you need to do in order to survive at the Dos prompt is to get comfortable with, and understand three (non destructive) commands; "DIR", "CD" and HELP. That's it. ExifToolGUI and explorer can do the rest. Other Dos commands that are not necessary, but could make your life easier, are: "MD", "RD", "XCOPY", and "REN". Use caution with these as they will: Make a directory, Remove a directory, Copy files from one place to another, and Rename files. All have the potential of creating problems if they go awry.

The last, and most dangerous one is "DEL".
"DEL a.jpg"  is a file killer!         
"DEL *.*"     is a directory killer!         
"DEL *.* /s" is a drive killer!
"DEL" deletes files, and DOES NOT send them to the recycle bin. To recover a file that has been deleted from the Dos prompt, you'd better have some nice recovery software installed (which, I do). Don't fear it... respect it. While a very useful command, you need to think before you use it.

My whole point is that the command window, or Dos prompt, is nothing to be afraid of. People have written volumes about DOS commands; I could write a pamphlet and say the same thing. DOS is easy. Forget all the horror stories that you've heard about DOS. They are stories of a youngster who, having just gotten their driver license, gets into a formula race car, and stomps on the gas; meaning they tried to use the full power of DOS before they understood the full power of DOS.

In fact, what makes Exiftool.exe, the non GUI, version so powerful is because it does work at the command leve, at the Dos prompt. Because of this you don't go through a user interface; you don't have to worry about learning how to get the interface to do what you want. You learn a few, simple, commands and you operate on the the files directly. So cool!

Now the down side of that is that you don't have the GUI checking for common errors and stopping you before you make changes.

Hope this helps.

P.S. DOS is NOT "out to get you". (it's your computer that's out to get you).