Skip to content
Advertisement

Shell: How to move multiple files to a directory and zip that directory with different name?

Fore example, I have some files in my project, structure could be like this

JavaScript

I want to zip some files from my project and I can do that using ZIP command (build folder and some other files are excluded from zip)

JavaScript

After this new file is created:

JavaScript

In Mac Finder when I double click on this file it becomes unzipped like this:

JavaScript

I would like to somehow zip this archive, so when it’s unzipped, instead of “project-04.05.2016” I get a folder “project” with the same content. I was trying to rename the file to “project-04.05.2016” after it’s zipped as “project”, but when it’s unzipped the results are the same. Maybe there’s a way to first move the files to some temporary “project” folder and than to zip them to “project-04.05.2016.zip”? Thanks in advance.

Advertisement

Answer

Here is my current solution, it’s a small script and I’m not too satisfied with it, but it works. I will accept if someone answers with more elegant solution. So, here it is:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement