Correct use of Get-ChildItem in Windows PowerShell for files bulk processing

Started by Danika Li, July 09, 2021, 08:51:24 AM

Previous topic - Next topic

Danika Li

Hello! I'm trying to use PowerShell to bulk process PDF documents using ExifTool, and I'm not very good at it. More precisely, it doesn't work at all.

Get-ChildItem -Recurse -Include *.pdf -Name | <path to app>\exiftool.exe -s

(Current folder - folder with documents.) Shouldn't this command list PDFs in the specified folder in relative path format, and pass it to ExifTool to display all the metadata? If the specified (and similar) action cannot be performed without knowledge of scripts, then maybe it is possible to do it in the old Windows console (cmd.com - with MS-DOS commands)?

exiftool 12.2.8.0
Microsoft Windows 10.0.19043.1083
Windows Terminal Preview 1.9.1523.0

Phil Harvey

You can use exiftool to find the PDF's:

exiftool -ext pdf -r DIR

- 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 ($).

Danika Li

Quote from: Phil Harvey on July 09, 2021, 10:53:21 AMexiftool -ext pdf -r DIR

<folder containing document folders>>exiftool.exe -ext pdf -r DIR -charset filename="" -Author<="<path>\Автор.txt" -overwrite_original
Error: File not found - DIR. You were meant to enter any valid directory name, not "DIR" literally.

exiftool.exe -ext pdf -r DIR "<path>" -charset filename="" -Author<="<path>\Автор.txt" -overwrite_original
Error: File not found - DIR
You were meant to enter any valid directory name, not "DIR" literally.
Warning: [minor] Ignored empty rdf:Seq list for dc:creator - <path>/FileName.pdf
Warning: [minor] Ignored empty rdf:Seq list for dc:creator - <path>/FileName.pdf
3 directories scanned
3 image files updated

exiftool.exe -charset filename="" -ext pdf -r DIR "<path>" -City<="<path>\City.txt" -overwrite_original
Error: File not found - DIR
You were meant to enter any valid directory name, not "DIR" literally.
3 directories scanned
3 image files updated


Thank you! In the second and third cases, the tags are correctly entered into the documents. But what do the warnings mean?

Phil Harvey

All the clues are there.

Read my signature and pay attention to this message:

You were meant to enter any valid directory name, not "DIR" literally.

- 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 ($).

Danika Li

Quote from: Phil Harvey on July 09, 2021, 12:08:50 PMdirectory name, not "DIR" literally.
Thank you again! I had disabled the display of signatures, and I did not know that it is customary on this forum to post useful information in them. It's Friday night, it's hot, and I'm slowing down in obvious things. I beg your pardon for my lack of understanding. Yes,

exiftool.exe -charset filename="" -ext pdf -r "<path>" -City<="<path>\FileName.txt" -overwrite_original

command works as it should. This is much better than my 8MB .cmd file with 20,000+ commands that I glued together in Excel.

Phil Harvey

...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 ($).