Archive Files Not In Folder - Possible?

Post Reply
matt.baile
Member
Posts: 43
Joined: Wed Nov 29, 2017 4:36 pm

Archive Files Not In Folder - Possible?

Post 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?
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Archive Files Not In Folder - Possible?

Post 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.
matt.baile
Member
Posts: 43
Joined: Wed Nov 29, 2017 4:36 pm

Re: Archive Files Not In Folder - Possible?

Post 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
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Archive Files Not In Folder - Possible?

Post by Padawan »

I assume you have a working command in Cmd? Can you share that?
matt.baile
Member
Posts: 43
Joined: Wed Nov 29, 2017 4:36 pm

Re: Archive Files Not In Folder - Possible?

Post 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
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Archive Files Not In Folder - Possible?

Post 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
matt.baile
Member
Posts: 43
Joined: Wed Nov 29, 2017 4:36 pm

Re: Archive Files Not In Folder - Possible?

Post 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
matt.baile
Member
Posts: 43
Joined: Wed Nov 29, 2017 4:36 pm

Re: Archive Files Not In Folder - Possible?

Post by matt.baile »

2.png
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Archive Files Not In Folder - Possible?

Post 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
matt.baile
Member
Posts: 43
Joined: Wed Nov 29, 2017 4:36 pm

Re: Archive Files Not In Folder - Possible?

Post 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
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Archive Files Not In Folder - Possible?

Post by Padawan »

You’re welcome :)
Post Reply