How to get something like {filepath-sourcepath}?

Hi,

my function list

Go "M:\Tracks\05_Tagging\01_SOX" DUALPATH "M:\Tracks\05_Tagging\02_RFDGS"
Select ALLDIRS
Copy FILTER="Folders Only"
Set FLATVIEW=mixednofolders,on
Select ALLFILES
"C:\Program Files (x86)\sox\sox.exe" "{filepath}" "M:\Tracks\05_Tagging\02_RFDGS\{sourcepath|noroot}"

should run sox tool on all files in all directories and subdirs and re-write the (wav) file in clean form (no tags, etc.).

Line 1, sets my directories
Line 2, selects all directories for Line 3
Line 3, creates the directory structure on the destination because sox requires that the path of destination file must exists.
Line 4, sets flatview on to list all files only
Line 5, selects all files
Line 6, should generate a line for each file - but the 2nd parameter drives me nuts.

E.g. in source directory I have (notice the subdirs "CDx" in 255909 lines)

M:\Tracks\05_Tagging\01_SOX\145618\01 Crazy.wav
M:\Tracks\05_Tagging\01_SOX\145618\02 Crazy (Extended Version).wav
M:\Tracks\05_Tagging\01_SOX\145618\03 Krazy.wav
M:\Tracks\05_Tagging\01_SOX\255909\CD1\01 Wood Beez (Pray Like Aretha Franklin) (12' version).wav
M:\Tracks\05_Tagging\01_SOX\255909\CD2\01 Small Talk.wav
M:\Tracks\05_Tagging\01_SOX\255909\CD3\01 Wood Beez (Version).wav

and I would need this destination path as 2nd parameter:

M:\Tracks\05_Tagging\02_RFDGS\145618\01 Crazy.wav
M:\Tracks\05_Tagging\02_RFDGS\145618\02 Crazy (Extended Version).wav
M:\Tracks\05_Tagging\02_RFDGS\145618\03 Krazy.wav
M:\Tracks\05_Tagging\02_RFDGS\255909\CD1\01 Wood Beez (Pray Like Aretha Franklin) (12' version).wav
M:\Tracks\05_Tagging\02_RFDGS\255909\CD2\01 Small Talk.wav
M:\Tracks\05_Tagging\02_RFDGS\255909\CD3\01 Wood Beez (Version).wav

Finally something like "filepath minus sourcepath" should result in e.g. only "145618\01 Crazy.wav" or "CD1\01 Wood Beez (Pray Like Aretha Franklin) (12' version).wav" .. then I would add the destination path as prefix (and finally have the full path + filename).

I spent the whole day with that (but only because I need it very often) - until yet I made a copy of path + file name and copied it in Ultraedit and replaced the directory path with a script inside Ultraedit and copied the lines into the CMD window ... but I want to avoid this overhead.

Would be also great if the last line wouldn't always open a new DOS window for each line (slower process).

Any idea how I can use DO only for this operation?

Thanks a lot!

1 Like

A script is the best way to tackle that. Doing it that way also means you can also do away with the messy Flat View and Select parts.

The script could enumerate the files in the subdirs, generate the appropriate command line for each file, then run the commands.

Hi Leo,

I've finished my jscript in the meantime and it works perfectly except ...

I generate a batch file with all my "sox" command lines and finally I call the batch file with

    var fact = DOpus.Create();
    var cmd = fact.Command;

    try
    {
      DOpus.Output("Executing file [" + this.BatchFilename + "].");
      cmd.RunCommand(this.BatchFilename);
    }
    catch(e)
    {
      throw new Error(1, "Couldn't execute [" + this.BatchFilename + "]: " + e.message);
    }

and after that I want to delete the batch file with

fso.DeleteFile(this.BatchFilename);

but the call is async and the script does not wait until the batch file is finished and deletes the batch file before it has started!

I've tried this "cmd.SetModifier("sync");" before "RunCommand" but it isn't supported (only "async"). And also "cmd.RunCommand(this.BatchFilename + " @sync")" ... but also does not work.

So how can I wait for the finished batch file and the deletion happens after that?

Thanks a lot.

Instead of creating your own batch file, you can have Opus handle all of that for you.

cmd.SetType("msdos"); cmd.AddLine(...); cmd.AddLine(...); cmd.AddLine(...); cmd.AddLine(...); cmd.AddLine("pause"); cmd.Run();