Copy path to text file, then create zip?

i have been able to set up a some buttons that i use to create backups by taking the selected files, zipping them and sending that zip file to a specific folder using a "Copy ZIP To=" command with "CREATEFOLDER=" so that i can give it specific names based on what, when, and where it's from.

is there a way to first copy the full path of the source path to a text file and have that also added to the zip file? the ideal solution would be for the text file to then be deleted and only exist in the zip file, but if it stays in the source folder it wont be a big deal.

Can you give us the current buttons (or a good example of one/some of them) so we can see how the paths are defined?

they are 4 seperate buttons setup to take the selected files, zip them, and send them to my "backup" folder. they create a 3-part name for the zip file. depending on the button, the first part is either the parent folder name, or it prompts me for a string. the second part lets me know whether it was in the "Program Files" folder or in the "Documents and Settings..." area. the third part is the current date. i dont so much need the text file for the stuff from "Program Files", but with the stuff under "Documents and Settings..." the path is not always apparent since it sometimes goes "Local Settings" first, and others, straight to "Application Data", and then sometimes it then goes through the software maker name...ect...

basically, i want to copy the full sorurce path (all the way to the drive letter) and put that into a text file called "path.txt", then add that to the zip file that selected files are going into. i doesnt bother me one way or the other if a copy of the "path.txt" is left in the source folder or only in the zip file. i was hoping that i could just add a line or two to these existing buttons to acheive what i amlooking for.

Copy ZIP TO="M:\Master Archive\Software.backups" CREATEFOLDER="{sourcepath|..|nopath} (Program Files) ({date|MM.dd.yy}).zip

Copy ZIP TO="M:\Master Archive\Software.backups" CREATEFOLDER="{sourcepath|..|nopath} (Application Data) ({date|MM.dd.yy}).zip

Copy ZIP TO="M:\Master Archive\Software.backups" CREATEFOLDER="{dlgstring} (Program Files) ({date|MM.dd.yy}).zip

Copy ZIP TO="M:\Master Archive\Software.backups" CREATEFOLDER="{dlgstring} (Application Data) ({date|MM.dd.yy}).zip

This should do it. Just change the first line to make each of the four versions.

It creates the temporary Path.txt file in the current folder so it will fail if the current folder cannot be written to (e.g. non-admin account backing up Program Files). You could modify it to create the temporary Path.txt in the temp dir if that is a problem, but then you should be careful not to run two copies of the button at once, or to make sure that the temp file paths are unique, else the buttons will overwrite each other's paths.

See here if you don't know what to do with the XML code below.

<?xml version="1.0"?> <button display="both" separate="yes"> <label>Zip to Backup</label> <icon1>#addtozip</icon1> <function type="batch"> <instruction>@set zipname={sourcepath$|nopath} (Program Files) ({date|MM.dd.yy})</instruction> <instruction>@set zipdest=M:\Master Archive\Software\.backups\</instruction> <instruction>@runmode hide</instruction> <instruction>@firstfileonly</instruction> <instruction>@nofilenamequoting</instruction> <instruction>echo {sourcepath$}&gt;&quot;{sourcepath$}\Path.txt&quot;</instruction> <instruction>Copy ZIP TO=&quot;{$zipdest}&quot; CREATEFOLDER=&quot;{$zipname}&quot; FILE=&quot;{sourcepath$}\Path.txt&quot;</instruction> <instruction>Copy ZIP TO=&quot;{$zipdest}&quot; CREATEFOLDER=&quot;{$zipname}&quot;</instruction> <instruction>Delete FILE=&quot;{sourcepath$}\Path.txt&quot; QUIET</instruction> </function> </button>

when i copy and paste the code as is, i get the error "An error occurred copying 'Path.txt': The system cannot find the file specified. (2)". i opened the ".backups" folder in the right-side lister and saw that it is creating either a correctly named zip file or a file named "File.zip" while the error message is up...if i hit "Retry" then nothing happens, if i hit "Skip", then i get a seocnd error that says "Cannot delete file: Cannot read from the source file or disk." and it continues and makes a second zip file with a name of whatever the first file selected was. the "File.zip" is empty and the other file has the correct contents minus the "Path.txt"

in case i cant get this to work, how would i do a button that just creates the "Path.txt" in the source folder (no delete or anything)?

Try the XML above again now. I've added @nofilenamequoting to fix the problem you found. (I forgot to test it when the source folder has a space in its name.)

For reference, here's the command in text format. Its function type should be set to MS-DOS Batch (which the XML in the post above will do for you):

@set zipname={sourcepath$|nopath} (Program Files) ({date|MM.dd.yy}) @set zipdest=M:\Master Archive\Software\.backups\ @runmode hide @firstfileonly @nofilenamequoting echo {sourcepath$}>"{sourcepath$}\Path.txt" Copy ZIP TO="{$zipdest}" CREATEFOLDER="{$zipname}" FILE="{sourcepath$}\Path.txt" Copy ZIP TO="{$zipdest}" CREATEFOLDER="{$zipname}" Delete FILE="{sourcepath$}\Path.txt" QUIET

it's sort of working...i'm still getting 2 files, one correctly named zip file with the Path.txt, and the other contains all the selected files and the name is based on whatever the first selected files name is.

What's the path that you're running it from, and which items below it are selected?

i have tried it from multiple folders and always get the same result. for instace, i go here:

C:\Program Files\VirtualDubMod

i highlight these (first is a folder, the other two are files):

template
Codecs.ini
VirtualDubMod.vdi

and i get these two zip files:

template.zip
VirtualDubMod (Program Files) (11.21.08).zip

"template.zip" contains the selected files and folders, and "VirtualDubMod (Program Files) (11.21.08).zip" contains the "Path.txt". it seems no matter what folder i go to, and what files i attempt to copy, i get the same result.

Strange. I created the same files & folders and it still works fine for me.

I'm using Opus 9.1.1.5

This is what the command should look like if you edit it:

sorry my replys are so slow, the computer i am using Opus on is not online, so i mostly read and reply at work on a different computer.

my button matched your screenshot, so i am not sure what the deal is. i dont think my Opus is up to date (9.1.0..?), so maybe that's it. i may have to try and go to my brother's house this weekend and use his internet to update.

in the meantime, how do i setup a button just to create the "path.txt" file for now?

If you're using 9.1.0.x then it's not up-to-date. 9.1.1.5 is the latest version. That might account for the different behaviour.

This button will do just the path.txt part:

<?xml version="1.0"?> <button display="both"> <label>Create Path.txt</label> <icon1>#addtozip</icon1> <function type="batch"> <instruction>@runmode hide</instruction> <instruction>@nofilenamequoting</instruction> <instruction>echo {sourcepath$}&gt;&quot;{sourcepath$}\Path.txt&quot;</instruction> </function> </button>