Look into the find
command
Be sure to cd
to your input directory.
cd input_directory
find . -iname "*.ext" -exec convert -input {} -output {}.out \;
This results in .out
being appended to the name of your input file. Getting your stated output file I haven't figured out yet.
It's always wise to try out what find
does before running the -exec
that changes things.
cd input_directory
find . -iname "*.ext" -type f -exec ls -l {} \;
will do a sort of "dry run".
-exec
what command to run
{}
what file was found; one at a time
\;
need to use this to end an -exec
My limited experimentation indicates you do not need to quote {}
$ find . -type f -exec ls -bl {} \;
-rw-r--r--. 1 me me 0 Oct 20 19:03 ./a\ b\ c.txt
-rw-r--r--. 1 me me 0 Oct 20 19:03 ./abc.txt
$ ls -bl
total 0
-rw-r--r--. 1 me 0 Oct 20 19:03 a\ b\ c.txt
-rw-r--r--. 1 me 0 Oct 20 19:03 abc.txt
me ~/a $`
I have a text file, help.txt, that contains hints to all my hard to remember bash commands. I have it tied to a simple script to print out the file .., h
Here is a list of my find commands:
# searches for all files on the system for the string you fill in between the ""
sudo find / -type f -exec grep -il "" {} \;
# search for all files starting with python.
find / -iname 'python*'
# search for the file type .jpeg and sort the list by date
find ~ -iname "*.jpeg" -type f -exec ls -l {} \; 2>/dev/null | sort -r -k 8,8 -k 6,7M
# so I can remember the or syntax.
find ~ \( -iname "*.jpeg" -o -iname "*.png" \) -type f -exec ls -l {} \;