Need to create a "ZIP" file without a folder directory.

Post Reply
arothenberger
Newbie
Posts: 12
Joined: Thu May 29, 2014 10:48 am

Need to create a "ZIP" file without a folder directory.

Post by arothenberger »

I need to Archive (ZIP) a series of files so that when they get unzipped, it's just loose files and not files in a folder.

Any ideas?

Thanks,
Adam
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Need to create a "ZIP" file without a folder directory.

Post by gabrielp »

I believe this script will do it for you: https://github.com/open-automation/switch-flat-archive
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

Re: Need to create a "ZIP" file without a folder directory.

Post by freddyp »

And for those without the scripting module, use "Execute command" with the following settings (for OSX, for Windows only the Command is different):

Command: /usr/bin/zip
Arguments: -rj "%2" "%1" -x "*.DS_Store"
Output: File at path
Output extension: ZIP

This will still fail if in the directory structure there are duplicate file names. You can solve this by using "Rename job" in front of the zipping. "Rename job"?? Yes, a not so well-known feature of "Rename job" is that it has an option to "Flatten hierarchy (discarding folders)" and that option has a sub option to resolve file name collisions. So the result of this will be a job folder of just 1 level deep with all files in it. Running the above zip on the "renamed/flattened" job will always work.
Post Reply