i am using a command-line tool called TMX (https://github.com/tonybeltramelli/TMXResolutionTool) I want to execute this command on every .png file in a certain folder. How can i do that?
This is how it is used:
TMXResolutionTool <tmx path> <resize ratio>
TMXResolutionTool <image path> <resize ratio>
TMXResolutionTool <image path> <new width> <new height>
Cheers.
Open the parent directory where your folder is located. Then single-click on the folder where you wish to launch a Terminal window, click on “Finder” followed by “Services,” and select “New Terminal at Folder.” Or you can simply press the keyboard shortcut that you assigned before.
Once all of your files or folders are selected, use the keyboard shortcut Control-Command-I to access the Multiple Item Info window. Here, you can see the total number of selected items as well as their combined file size. Note the addition of the Control key to our normal “Get Info” shortcut.
find <path> -name "*.png" | xargs -Irepl TMXResolutionTool repl <ratio>
If you need to run all those commands in order on each file before moving to the next, a small bash script may be clearer
find <path> -name "*.png" | while read f ; do
TMXResolutionTool $f <resize ratio> ;
TMXResolutionTool $f <resize ratio> ;
TMXResolutionTool $f <new width> <new height> ; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With