The @ifset command modifier only works with the Set command.
(In hindsight, the @set command modifier should have been named something else to avoid this confusion. Or maybe the Set command should've been named something else, since it can also be confused with the DOS Set command. Lots of people's configs depend on the names now, though, so it'd be painful to change them.)
@ifset is also evaluated when the command is parsed, not when that line in the command is reached. It doesn't give full conditional branching / looping to Opus commands; it's much more limited than that.
If you need to do proper conditional branching, looping and variables, it's usually best to call into some VBScript, Javascript, or similar. i.e. Using Opus to run the script and pass the filenames, source directory or other required details to the script, with the script then taking over. (If the script needs to run some Opus commands, it can do so via "dopusrt.exe /cmd", although such externally-launched commands cannot use things like {dlgstring}. If you need to prompt the user, it either has to be done before the script is run, passing the user input to the script as arguments, or the script would have to display its own prompts.)