[SOLVED] problems with a CommandExecuter

Questions and answers on how to get the most out of FFAStrans
Post Reply
ThomasM
Site Admin
Posts: 231
Joined: Wed Feb 22, 2017 6:36 am

[SOLVED] problems with a CommandExecuter

Post by ThomasM »

Hi Folks,

I am trying to do a batch-processing with xxHash on a set of DPX-Files. I want to hash every single file and put the hash and the Filename one Folder up in a LOG.

For the One-FolderUp I created a Variable:
%s_dir_1up% = $regext("%s_original_path%","(.*)\\")
I use this with many Workflows.

For the Hashing I tried hard to get so far:
%comspec% /C "
FOR %A IN ("%s_original_path%")
DO
("%s_ffastrans_dir%\xxhsum.exe" "%A"
>> "%s_dir_1up%\xxHash.JSON")
"
When I replace
FOR %A IN ("%s_original_path%")
with
FOR %A IN ("*")
It will populate the LOG with Windows-related Files

I also tried things like
FOR %A IN ("%s_original_path%\*.*")
with no luck.

Any ideas?

thanks a lot,
regards
tom
Last edited by ThomasM on Mon Aug 10, 2020 10:40 am, edited 1 time in total.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: problems with a CommandExecuter

Post by emcodem »

Hey Thomas,

sorry i cannot answer your question directly, not an expert for batching but i turned away from the for function and use forfiles for file processing. I always had troubles with using ", (, newlines and DO in this command style.
Also i do go "up one folder" by using "\.."

Here is a working forfiles example, just copy and paste exactly this in your commandline processor. Note that i use another xxhsum tool because i dont have the one that you use on my harddrive.

Code: Select all

forfiles /P "%s_original_path%\.." /C "cmd /C "%s_ffastrans_dir%\Processors\resources\xxhsumX86.exe" "@path" > "@path.txt""
Also note, please dont confuse the "/C" above that is part of the forfiles command and the /C that belongs to the cmd command.
I hope it is somehow understandable for you ;-) Forfiles is a tool that lets you process files smarter than for, it exposes the found files properties using the @ symbol, in our case @path just means the full path of the current file....

If you want to go down the route of debugging your command anyway, you need to first use a write text file processor instead of the commandline processor and copy/paste the generated command on commandline (renaming to bat does not work because bats need doubel %% in for statements). Then tear it apart and play with it as long as you got it working
emcodem, wrapping since 2009 you got the rhyme?
ThomasM
Site Admin
Posts: 231
Joined: Wed Feb 22, 2017 6:36 am

Re: problems with a CommandExecuter

Post by ThomasM »

Image

FORFILES... GEEEZ...

Thank you very much, emcodem! That´s it!
ThomasM
Site Admin
Posts: 231
Joined: Wed Feb 22, 2017 6:36 am

Re: problems with a CommandExecuter

Post by ThomasM »

In the end...
I got my one working too:

Code: Select all

%comspec% /C "
FOR /R "%s_original_path%\" %A IN ("*.DPX")
DO
"%s_ffastrans_dir%\xxhsum.exe" "%A"
>> "%s_dir_1up%\xxHash.txt"
"
So I got the choice now...

Thanks to @emcodem!
Post Reply