Make a list of selected files and save it as text file

I need to make a botton that can generate a text file with a list of all selected files.

Example:

If I select the files: lorem.foo, ipsum.bar and _dolor.fo_o and click on the button I get a text file with:

file 'lorem.foo' 
file 'ipsum.bar' 
file 'dolor.foo'

Usually I would do this with the command line: (for %i in (*.foo) do @echo file '%i' ) > list.txt however I need a button in Dopus that can do this for me. Also I need the list to be of the selected files only.

Could anyone help me out here? I am not sure what to write in the button.

Edit > Copy FIle Names will put the selected file names into the clipboard.

If you want to surround each name with file `...` then you could use:

Clipboard COPYNAMES=nopaths REGEXP "(.*)" "file '\1'"

To build on top of Leo's code, just in case you weren't sure, you could create the .txt file straightaway without having to paste and rename.

Clipboard COPYNAMES=nopaths REGEXP "(.*)" "file '\1'"
Clipboard PASTE AS "File List"
1 Like