Passing parent name with normal and compressed folder

Hi,

1- I have multiple folders with images and I would like to copy images I want into a sub-folder "[-REFERENCES-]" inside parent folder of the selected file(s). So I have made this button which adds also the prefix I like to the file(s) name.

@set Prefix={Rs|Add Prefix to file name} Copy {f} TO {f|..\..} WHENEXISTS=rename CREATEFOLDER=[-REFERENCES-] AS="{$Prefix} - *"
It works without any issue.
Anyway, my first idea was to add automatically the parent folder name as prefix instead of the current solution. I tried such button but it does not work:

Copy {f} TO {f|..\..} WHENEXISTS=rename CREATEFOLDER=[-REFERENCES-] AS="{o|..\..} - *"

But reading the help file (References / Command references / External control codes / Codes for passing filenames), it seems the code ".." works only with file path.

[quote="help file"]For example, {file|..} might return C:\Program Files\ where as {file|..|noterm} would return C:\Program Files.[/quote]I thought such command should return "Program Files" since {o} has been used instead of {f}.

So, is it a way to do what I would like to do?

2- Zip folders are much more efficient than non compressed folders so instead of using folder for my images, I am using zip folders also...My problem is my button does not work at all with zip file.
Is it possible to duplicate a selected file (inside a zip) in a parent folder outside of the zip file? I was only able to duplicate files in Windows temp folder...

I hope someone would be able to help me or maybe someone will avoid me to spend some time looking for a solution that does not exist :stuck_out_tongue:

Try playing with this variation:

  • I kept the "@set" bit in the first line of your original command, and put the modification in there just so you can SEE my interpretation of what I "think" the result you're after looks like, before actually copying the files.
  • Plus, this way you can also override the derived prefix if you want to - or just hit Enter/OK to accept it as is.
  • Lastly, I modified some of the bits you were using in the actual copy command... "{f|....}" is the same as just ".." (or {s|..} for that matter. And I'm surprised appending the wildcard "*" at the end of the "AS" filename actually worked... I changed it to use {o} so you're majority using Opus control codes.

@set Prefix={RS|Add Prefix to file name|{s|..|nopath|noterm}} Copy {f} TO .. WHENEXISTS=rename CREATEFOLDER="[-REFERENCES-]" AS="{$Prefix} - {o}"

[quote="steje"]Try playing with this variation:

  • I kept the "@set" bit in the first line of your original command, and put the modification in there just so you can SEE my interpretation of what I "think" the result you're after looks like, before actually copying the files.
  • Plus, this way you can also override the derived prefix if you want to - or just hit Enter/OK to accept it as is.[/quote]Many thanks steje, your last idea is better than what I was looking for originally :smiley:

[quote="steje"]- Lastly, I modified some of the bits you were using in the actual copy command... "{f|....}" is the same as just ".." (or {s|..} for that matter. And I'm surprised appending the wildcard "*" at the end of the "AS" filename actually worked... I changed it to use {o} so you're majority using Opus control codes.[/quote]I thought for any reason that ".." should be used only inside {}, thanks for pointing my mistake. Thanks also for fixing my improper use of wildcard/opus control codes. And I didn't think it was possible to use a {s} inside {Rs}, that's opening a lot of new possibilities :open_mouth:

[quote="steje"]@set Prefix={RS|Add Prefix to file name|{s|..|nopath|noterm}} Copy {f} TO .. WHENEXISTS=rename CREATEFOLDER="[-REFERENCES-]" AS="{$Prefix} - {o}"[/quote]Great!
I just modified it a little bit to match what I need:

@set Prefix={Rs|Add Prefix to file name|{s|nopath|noterm}} Copy {f} TO .. WHENEXISTS=rename CREATEFOLDER=[-REFERENCES-] AS="{$Prefix} - {o}"
Now I realize I was not so easy to understand in my first post since I have not even given an example... :confused:

Here an example of what I needed to do:
Main Folder \ Sub-Folder1 \ Image1.jpg
Main Folder \ Sub-Folder1 \ Image2.jpg
Main Folder \ Sub-Folder2 \ Image1.jpg
...
I needed to copy images from Sub-folders in new folder inside Main Folder, so after the copy I got something like that
Main Folder \ [-REFERENCES-] \ Sub-Folder1 - Image1.jpg
Main Folder \ [-REFERENCES-] \ Sub-Folder2 - Image1.jpg
Main Folder \ Sub-Folder1 \ Image1.jpg
Main Folder \ Sub-Folder1 \ Image2.jpg
Main Folder \ Sub-Folder2 \ Image1.jpg
...

About using it with zip files containing images, I would like to obtain the same result, so...
Main Folder \ Compressed Folder1.zip \ Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image2.jpg
Main Folder \ Compressed Folder2.zip \ Image1.jpg
...

After the copy...
Main Folder \ [-REFERENCES-] \ Compressed Folder1 - Image1.jpg
Main Folder \ [-REFERENCES-] \ Compressed Folder1 - Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image2.jpg
Main Folder \ Compressed Folder2.zip \ Image1.jpg
...

Now, I just read your post from this thread that allows to bypass my problem with zip files using

dopusrt /cmd copy here createfolder "{Rs|COPY to new folder...|{s}}"

I just need to edit it to create a new folder if it is possible (and add prefix if it is possible)...I will try now and post the result if I am able to make it works. Thanks again

Well, finally I needed to use a different button for zip files since I was not able to achieve what I would like to do.
Anyway, such expression is good enough.

dopusrt /cmd Copy here CREATEFOLDER="{s|..}[-REFERENCES-]\{s|nopath|noterm}"

too bad the modifier {s|nopath|noterm|noext} does not exist with {s}

Thanks again steje

I think it's because folders may not "actually" have what the OS considers to be "extensions"... I believe that any "." in a folder name is considered to be part of the actual folder name, and not an "extension" per se.

That said... you could always ask GPsoft if Opus could be "made" to interpret NOEXT in a path related control code as an indication to omit any trailing ".****" chars in a folder name. Or - if you're needing this when trying to do things with files inside of zip files - maybe there's some other solution. Lastly, you could possibly just handle whatever you're doing via a script of some sort.

[quote="steje"]That said... you could always ask GPsoft if Opus could be "made" to interpret NOEXT in a path related control code as an indication to omit any trailing ".****" chars in a folder name.[/quote]Well, I would prefer something that reduces zip folder limitations with "copy" and "as" since that's not the first time I need to deal with that.

Yes, having one button that can work for zip folder and normal folder with exactly the same behavior would great but it is really the first time I have an issue with that and it is needed in a very specific situation. In fact I needed to create such "zip" folder....
Main Folder \ [-REFERENCES-] \ Compressed Folder1.zip \ Image1.jpg
Main Folder \ [-REFERENCES-] \ Compressed Folder2.zip \ Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image2.jpg
Main Folder \ Compressed Folder2.zip \ Image1.jpg
...only because DOpus is unable to extract and rename in the same time files inside zip archive.
I looked for such result originally:
Main Folder \ [-REFERENCES-] \ Compressed Folder1 - Image1.jpg (or Compressed Folder1.zip - Image1.jpg....I don't care)
Main Folder \ [-REFERENCES-] \ Compressed Folder1 - Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image1.jpg
Main Folder \ Compressed Folder1.zip \ Image2.jpg
Main Folder \ Compressed Folder2.zip \ Image1.jpg
Now, I have no idea the reason of such limitation.

I am thinking about filling a feature suggestion.