Bizi Kneidinger
Bizi Kneidinger

Reputation: 25

move files to .zip archive in windows command line

I wanted to know how to move files to a .zip archive. I'm using this code: xcopy C:\Folder C:\AnotherFolder\zippedFolder.zip. This copies the files from C:\Folder DIRECTLY into the archive, but I want to have that file in the archive (so i can doubleclick the archive and see the file unopened).

Want to do this to create an excel file with a .cmd

Upvotes: 1

Views: 12766

Answers (1)

Shaig Khaligli
Shaig Khaligli

Reputation: 5485

Use -m to import a file to a ZIP archive.

I found this on StackOverflow maybe it helps you.

How to move a file in to zip uncompressed, with zip cmd tool

But be careful it deletes the source file after it adds it to the archive. See the link for more details.

UPDATE

Instructions from this site. http://linux.about.com/od/commands/l/blcmdl1_zip.htm. -m moves the specified files into the ZIP archive; actually, this deletes the target directories/files after making the specified ZIP archive.

If a directory becomes empty after removal of the files, the directory is also removed. No deletions are done until zip has created the archive without errors. This is useful for conserving disk space, but is potentially dangerous so it is recommended to use it in combination with -T to test the archive before removing all input files.

zip -m yourfile zip.file

Upvotes: 2

Related Questions