I have a zip.exe in my cmd shell. I would like to zip a folder in any subfolder, but don't want the folder to be zipped also.
Sample. I have the following situation:
c:/mainfolder/projectfolder/file.txt c:/batch/zip.exe The content of the resulting zip should be
projectfolder projectfolder/file.txt I would like to zip projectfolder, so the content of the zip file has only projectfolder with its file.txt. Mainfolder should not be visible. I also would like to do this as a oneliner.
My attempt did not work:
c:/batch/zip.exe -FSJr c:/mainfolder/projectfolder.zip c:/mainfolder/projectfolder Any help ?
02 Answers
The folder will be zipped if it is specified, so the trick is not to specify it.
Do something similar to:
cd c:/mainfolder/ c:/batch/zip.exe -FSJr c:/mainfolder/projectfolder.zip * 1UPDATE:
Change your current work directory to the source directory.
cd c:\mainfolder\
zip -FSJr c:/mainfolder/projectfolder.zip *
p.s.: You could copy zip.exe to c:\windows this way you don't need to specify the fullpath to zip cmd. the .exe extension is not neccessary to write.
Do not use the -r switch
-r Travel the directory structure recursively Just use zip.exe -FSJ c:/mainfolder/projectfolder.zip c:/mainfolder/projectfolder.