简体   繁体   中英

How do I run a command on all files in a folder (which has sub-folders) using ExifTool?

I have a folder called Photos & Videos .
It has folders for the various years for which I have photos and videos.
The year folders have folders for months and the months folders have folders for the days of that month.
The days folders contain all my image and video files.

Now, I want to run commands on all these files using one single exiftool command.

For example, to remove the metadata of all files in a folder, I'm running this type of command on every single day folder one at a time.

exiftool -all= -overwrite_original Documents/Personal/Photos\ \&\ Videos/2015/3-2015/7-3-2015/ .

The problem is I have too many days folders.
So, is there a way I can target all the files in the Photos & Videos folder all at the same time using one single command.

Please help

Add -r to your command. -r will recuse into all the subdirectories.

A more generic solution that will work for all commands is to use find .

find Documents/Personal/Photos\\ \\&\\ Videos/2015/3-2015/7-3-2015/ -type f will print out every file in Documents/Personal/Photos & Videos/2015/3-2015/7-3-2015 . To run a command on each of those files, you can use the -exec parameter, with an admittedly odd syntax:

find Documents/Personal/Photos\ \&\ Videos/2015/3-2015/7-3-2015/ -type f -exec exiftool -all= -overwrite_original '{}' \;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM