find -exec equivalent for batch processing

Have a suggestion for "Everything"? Please post it here.
Post Reply
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

find -exec equivalent for batch processing

Post by phil2search »

Hello,

perhaps there is already a way to do it otherwise it could be a suggestion.

I use regularly the find shell utility (on linux...) which is really useful for automation as it can be used interactively.
In particular:
find path -name "test*" -exec ...
or
find path -name "test*" -print | xargs...

to execute a command on the result of the search (one file by one file).

On windows, I guess using the command line es.exe is an option but it would be great to be able to do that within the main Everything interface.
It there a way to pipe the result of a search (or even better a selection) to an external command within the gui? Some type of batch processing mode.

Thank you again for everything ;-) !
Philippe
void
Developer
Posts: 16735
Joined: Fri Oct 16, 2009 11:31 pm

Re: find -exec equivalent for batch processing

Post by void »

ES is going to give you more control.

A couple thoughts:

Create a bat file in your shell:sendto folder

Example.bat

Code: Select all

"My Program.exe" %*
Right click your selection in Everything and under Send to, click Example.bat
This will launch Example.bat once with all the files passed as parameters.
There's a limit of about 8k characters.



Create your own context menu item for all files:
  • From the Start menu, search for:
    regedit
  • Click Registry Editor.
  • In the Registry Editor, navigate to:
    HKEY_CLASSES_ROOT\*
  • Create a new Key called:
    shell
  • navigate to:
    HKEY_CLASSES_ROOT\*\shell
  • Create a new Key called:
    My Program
  • In this key, Create a new Key called:
    command
  • In this key, set the (Default) value to:
    "C:\Program Files\My Program\My Program.exe" "%1"
  • Now you can right click your files and click My Program...
This will launch "My Program.exe" for each individual file.

More here.
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

Re: find -exec equivalent for batch processing

Post by phil2search »

I'll look into it
Thank you!
Philippe
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

Re: find -exec equivalent for batch processing

Post by phil2search »

Hello,

after looking into it, it kind of works:

1) with es.exe: I used an xargs windows replacement called wargs (MIT license, https://github.com/idigdoug/TextTools).
e.g. to process the search results with 4 processes in parallel :

Code: Select all

es -double-quote ext:jpg roof_  | wargs -P 4 -I f jpegrecompress.bat f 
For accentuated characters (wconv is provided with wargs):

Code: Select all

es -double-quote ext:jpg roof_  | wconv -f utf8 | wargs -P 4 -I f jpegrecompress.bat f 
I find it limiting though (difficult to visualize or edit the list, that is the interest of everything).

2) with everything:
using sendto with a batch seems an issue (argument limited to 8191 characters, quickly reached with many files).
Alternatives for communication include the clipboard (works but does not feel like a good idea) or saving a temporary file:
  • Code: Select all

     wconv -f utf8 tmp.txt | wargs -P 4 -I f jpegrecompress.bat f 
    where tmp.txt is the list of files with double quotes (easy to copy paste and possibly edit the file).
  • Code: Select all

     for /F "skip=1 tokens=1 delims=," %i in (test.efu) do @echo %i | wconv -f utf8 | wargs -P 4 -I f jpegrecompress.bat f 
    to use directly an efu file (e.g. generated with the file list editor). That may be the best way (also keeps a trace of the original files). I did a small script wrapper if anyone is interested.
I think it would still be cool one day to do all that directly in everything.
In principle, it seems very similar to the advanced rename: instead of rename, execute a script (selected by the user) taking the filename (source and target) as argument. It would add a batch processor functionality in a way (a bit like virtualdub for example but more open).
Multiple jobs in parallel would be the cherry on the cake.
Anyhow.

Thanks for everything ;-)
Philippe
Post Reply