How to access source/dest with this script

I have the following setup as a buttonfor %%f in (*.php) do sed -f commands.txt %%f >edited_files\%%f doneIt will read through all of the files in the current directory and rewrite them, minus any blank lines. The script works fine but it would be better if I could choose the source and dest. Would someone please show me how to do that, if it is possible?

Choose source and dest "what"? Paths? Files? How would you use such info in the command?

The script, as it is, loads whatever .php files are in the current directory, where the script is located, and writes the changed files to a sub-directory at that location. That means that in order to use the script, I have to copy whatever files I want edited into that directory first. I run listers in dual mode and would like to be able to select a file in the source lister and have the results created in the dest lister.

{sourcepath} and {destpath} will get you the source and destination paths.

Note that you could do something similar without the DOS for-loop, acting on the selected files:

sed -f commands.txt {filepath$} >edited_files\{file$}

Of course, that will act on the selected files which may not be *.php, so maybe your existing method is nicer for what you're doing. Just thought I'd mention it as another possibility.

One could apply a filter to show only .php files, select some and press the buttons.

btw, are any control structures possible in DOpus scripts?

Opus only supports scripting directly for rename operations, but you can abuse rename scripting to do other things.

Of course, you can also call external script files, passing them whatever arguments they need and running Opus commands from them via dopusrt.exe.

[quote="leo"]{sourcepath} and {destpath} will get you the source and destination paths.

Note that you could do something similar without the DOS for-loop, acting on the selected files:

sed -f commands.txt {filepath$} >edited_files\{file$}

Of course, that will act on the selected files which may not be *.php, so maybe your existing method is nicer for what you're doing. Just thought I'd mention it as another possibility.[/quote]This seems to do just what I want it to do. The only thing I want to change with it is have the file written to the same location, overwriting the original, or maybe renaming the original to something else. But I tried the following and it doesn't work:

cd E:\PathToSedScript\ sed -f commands.txt {filepath$} >{filepath$}

It appears to work (cmd window opens and text scrolls) but the file is not changed. I looked at the other arguments but didn't see one that fit better than filepath$. Would someone please point out the mistake?

Try doing a similar thing from the command line, without Opus involved and you'll probably find that doesn't work either.

You are telling sed to overwrite the file with a blank file (to which any further output will be written) before it even starts reading the same file as its input.

Your version of sed may have an option to modify a file in-place. (There are lots of different versions of sed, though.)