Get each {filepath} of {allfilepath}

Hi all..

I've just created a button to run UglifyJS.. the button code currently is as follows:

uglifyjs {filepath$} -o {filepath|noext}.min.js

Nothing funky or clever, and this works just fine for single files.. however, what would be more convenient is to swap the first {filepath$} with {allfilepath$} and process numerous files, but I can't seem to find the "current file" tag for writing.. for example, I tried:

uglifyjs {allfilepath$} -o {allfilepath|noext}.min.js

and this failed. I've tried a few other combinations too to try and achieve this.. but alas, everything has fallen over. Is there a simple way of using a {tag} for the "current file" of an {allfilepath} operation without resulting to writing a custom script for it? (it's years, or rather decades since I meddled with VBS).

TIA for any help / info offered :slight_smile:



The first one will already run the command once per file, if that's what you want.

If it's not what you want, please give some example filenames and the output you want to be generated.

Hi Leo..

Thanks for your quick response :slight_smile:

I'm looking to select multiple files and generating multiple files with different filenames, for example:

script1.js -> script1.min.js
script2.js -> script2.min.js
script3.js -> script3.min.js

Currently, I can get script1.js -> script1.min.js no problem, but can't generate the multiple file outputs.



Ahah! Just solved it by looking at one of my previous Git buttons I created... using the @sync modifier:

@sync:uglifyjs {filepath$} -o {filepath|noext}.min.js

This seems to do the job I'm after :slight_smile:



It should work with or without @sync. (At least assuming uglifyjs can be run multiple times at once and there's no dependencies between each file.)

Without @sync it might run the command for each file in parallel instead of in series. (Special case when the command only has one line that runs an external program.) Adding @sync forces it to run in series, one after the other.