Script Help

This is somewhat an offshoot of the presumed zip file caching issue I raised the other day and partly a desire to make my life easier. I finally settled on copying the zip files to the target directory and unzipping them in place, then deleting the zip files. It's a bit awkward and slow, especially since the target is across the network, but I can live with it.

Now I'd like to add some automation to the whole procedure. I've given this some thought and I think the steps will work, I just don't know how to do them with Opus commands. Maybe you script gurus can help.

  1. Create a subdirectory in the dest lister. The name doesn't matter (because we're going to change it later).
  2. Copy the selected files from the source to the newly created subdirectory.
  3. Select the files in the new subdirectory and unzip them in place (i.e. to the same directory).
  4. Delete the zip files. It is not anticipated that any of the zips will contain other zips, so deleting *.zip in the new subdirectory should be sufficient.
  5. Rename the newly created subdirectory using a substring from the name of the first file in the directory. (I'll have to tweak the substring part. For now let's just say use the first 15 characters of the filename as the new directory name.)
  6. Delete the originally selected files in the source lister.

Is this possible?

You can do this very simply, at least if you're happy for the created directories to be named after the zip files (rather than the first file within each zip file):

Copy EXTRACT=sub Delete

Change the second line to Delete QUIET if you don't want the confirmation dialog.

Before and after screenshots below that show what the button does:



That's the problem. The zip files are all named alike. One set will be xxx1.zip, xxx2.zip, xxx3.zip. The next set will be xxx1.zip through xxx5.zip, where 'xxx' are the exact same letters in all cases.

The files within the zips are named uniquely, but the zips are rather generic.

This was why I wanted to do the rather peculiar thing of creating a directory first, unzipping to it, and then renaming the directory. It also turns out the zip caching issue extends to network drives as well. I was manually doing pretty much what was described, using 'zzzz' as the initial directory name. Then I started getting the caching problem where the zips refused to extract. I was forced to use random sequences for the initial directory name.

Would it solve the problem to put the current date and time into the destination folder name? That way you don't have to worry about the archive names not being unique (unless you extract two with the same name in the same second).

If so, here's the command:

@nofilenamequoting Copy EXTRACT CREATEFOLDER="{destpath$}\{file|noext} {date|yyyy-MM-dd} {time|HH-mm-ss}" Delete

Close enough. Thanks, Leo.

It has been so long since I customized Opus that I embarrassingly forgot how to do it!

This sounds like the exact function I need, but I forgot how to create a script button (and I searched a long time.) Thanks for the help.

Watch the video on toolbar editing in the tutorials section here. That's the best way to get up to speed.

[quote="netsez"]It has been so long since I customized Opus that I embarrassingly forgot how to do it!

This sounds like the exact function I need, but I forgot how to create a script button (and I searched a long time.) Thanks for the help.[/quote]

See Combination of renaming and move in one process