Skip to content

Instantly share code, notes, and snippets.

@brockthebear
Last active November 15, 2024 16:22
Show Gist options
  • Save brockthebear/5c05bfd51199bc82bf29c51fafd42208 to your computer and use it in GitHub Desktop.
Save brockthebear/5c05bfd51199bc82bf29c51fafd42208 to your computer and use it in GitHub Desktop.
Recursively find and convert files in place using ImageMagick and Mogrify
# This command would be run from the parent folder that:
# 1. contains the file(s) to be converted
# 2. has subdirectories that contain files to be converted
# 3. both of the above.
# This example finds all .tif files and converts them to .pdf,
# but any conversion supported by ImageMagick could be used here.
# If you don't have ImageMagick installed, you can do so here (https://imagemagick.org/script/download.php)
# for linux
for f in $(find . -name '*.tif');
do echo "Converting $f";
mogrify -format pdf "$f";
done;
# for windows
# for /r /d %a in (*) do mogrify -format pdf "%~a\*.tif"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment