badsand.blogg.se

Mac create zip file command line of a folder
Mac create zip file command line of a folder










mac create zip file command line of a folder

I am not sure if the command wScript.Sleep 12000 (12 sec delay) in the original script is required or not, so I kept it. For me, it did not run out of the box, so I had to slightly change it. I like PodTech.io's answer to achieve this without additional tools. Is pretty short than i expected when start to play with. Is not neccesary to append ".zip" to name.

mac create zip file command line of a folder

So, we pass %d to both, wich is the current for iteration folder name zipped into a file with the folder name. You can try with myzip.zip, but if will fail because if you have 2 or more folders the second cannot gave the name of the first and will not try to overwrite without more params. r- is for recursive, so anyting will be added.įor /d %d in (*) do zip -r %d %d The first %d is the zip name. (exec zip itself and see the help display to use your custom rules). Not sure about issues with relatives from batch.įor /d %d in (*) do zip -r. (*) this will mean all on THIS dir, because we use /d the files are not processed so no need to set a pattern, even if you can get only some folders if you need. That suposses that I CD to desired folder, or run from. I put d to match widh d (directory meaning).įor /d %d in (*).

mac create zip file command line of a folder

the %d tells cmd wich name do you wanna assign to your variable. Only remember modify the %varname to %%varname before blame me :Pįor /d. Of course, i use CMD for better/faster testing instead batch. I got (extracted to target folder) zip.exe and cygwin1.dll from the cygwin package (3mb filesize both together) and start play with it right now.

mac create zip file command line of a folder

Use built-in zip manipulation is not like easy on Win, and even harder with batch scripting.īut you're lucky anyway. Second, i dont figure out how do you use zip from CMD. First, the batch (%%variable) and Windows CMD (%variable) uses different variable naming.












Mac create zip file command line of a folder