Page 1 of 1
Archive Files Not In Folder - Possible?
Posted: Thu Oct 04, 2018 3:04 pm
by matt.baile
I'm trying to zip three files together without putting them in a folder first. I was able to put the three files into a folder using the Assemble Job element and then use the Archive element to zip them, but the result is Zip>Folder>Files. What I need is just Zip>Files. Is there a way to do this within SWITCH?
Re: Archive Files Not In Folder - Possible?
Posted: Thu Oct 04, 2018 5:52 pm
by Padawan
I did some tests on this in the past but can't find the result anymore. Some things I do remember are:
- When testing, check the settings of the tool you use to unzip. Some tools create a folder from the moment there where multiple files in the zip, even if the zip itself didn't contain a folder. If you are sending the zip's to customers, then you won't have any control over the tool used to unzip.
- If the built in tools to zip and unzip don't suit your needs, then you can experiment with command line tools to do the zipping and automate them in Switch via Execute Command. I expect that both windows and osx have built in commands to zip. If they don't give the expected results, then you still try third party command line zip tools.
Re: Archive Files Not In Folder - Possible?
Posted: Fri Oct 05, 2018 8:54 pm
by matt.baile
Thanks! I did try to use the Execute command element using 7zip.
My command is: C:/Program Files/7-Zip/7z.exe
For arguments, I've tried the following:
7z a archive.zip * .\[Job.NestedName:Index="1"]\*
7z a archive.zip .\[Job.NestedName:Index="1"]\*
I then thought I might need to use the %1 and %2 arguments, but no luck either.
7z a %2/archive.zip %1/.\[Job.NestedName:Index="1"]\*
7z a "%2/archive.zip" "%1/.\[Job.NestedName:Index="1"]\*"
7z a "%2/archive.zip" * "%1/.\[Job.NestedName:Index="1"]\*"
I'm basically just passing a folder with 3 files inside of it on to the Execute command element. I want the files inside of that folder to be zipped and output.
2018-10-05 14_53_44-Terminals 4.0.1 (Files store).png
Re: Archive Files Not In Folder - Possible?
Posted: Sat Oct 06, 2018 9:15 am
by Padawan
I assume you have a working command in Cmd? Can you share that?
Re: Archive Files Not In Folder - Possible?
Posted: Mon Oct 08, 2018 10:19 pm
by matt.baile
I moved the 7z exe file along with a folder named 9780761900735 to the C:\Windows\System32\ folder. I ran the following successfully.
success.png
Re: Archive Files Not In Folder - Possible?
Posted: Tue Oct 09, 2018 8:14 pm
by Padawan
Ok, can you try this?
Command:
C:/Program Files/7-Zip/7z.exe
Arguments:
a %2 %1
Output:
File at path
Output extension:
zip
Re: Archive Files Not In Folder - Possible?
Posted: Wed Oct 10, 2018 3:40 pm
by matt.baile
I tried those arguments as an inline value and entering it as a single line text with variables. I've included a screenshot of the folder prior to the command. The folder with my files goes to the Problem Jobs folder, and I get the following error in the log:
Job failed because outcode is nonzero, outcode = [1]
Thanks for all of your help with this. I really didn't think this would be as troublesome as it is!
1.png
2.png
Re: Archive Files Not In Folder - Possible?
Posted: Wed Oct 10, 2018 3:42 pm
by matt.baile
Re: Archive Files Not In Folder - Possible?
Posted: Wed Oct 10, 2018 6:03 pm
by Padawan
Sorry, I forgot the qoutes. Can you use this as argument?
a “%2” “%1”
If it would fail again, please also provide debug logs. You can get them like this:
Enable debug logging in the logging category of the switch preferences
Reproduce the issue
Open the messages
Change the filter of the type column so debug messages are shown
Export or take a screenshot of the messages logged by execute command. Please make sure the full message is visible. You can enable text wrap via the three dots button
Re: Archive Files Not In Folder - Possible?
Posted: Wed Oct 10, 2018 7:34 pm
by matt.baile
EDIT:
This is now working with the following syntax for the Arguments: a "%2" "%1/\*"
Again, thank you so much for this!
Original Post:
Screenshot attached. I wasn't able to attach a CSV file unfortunatley. Thank you so much for helping with this!
log.png
Re: Archive Files Not In Folder - Possible?
Posted: Wed Oct 10, 2018 7:49 pm
by Padawan
You’re welcome
