Tuesday, August 26, 2008

ZIP command

zip -r target source

Examples

  • zip -r myarchive myfolder
    Creates myarchive.zip, an archive containing every files and directories present in myfolder, even files with a starting dot.
  • zip documents *
    Creates the documents.zip archive containing all the files in the current directory. Files beginning with a dot might be excluded depending on your shell filename expansion feature configuration. Directories will be empty in documents.zip.
  • zip documents *.sdw
    Creates the documents.zip archive containing all the .sdw files present in the current directory.
  • zip -r archive * -x \*.doc
    Archives all files and directories in the working directory excluding names with the .doc suffix. Please note the backslashed "*" character to prevent the shell from interpreting it. It will be interpreted and applied by the zip command instead, in all processed directories.
  • zip -g documents essays/*
    Appends all the files of the essays directory to the existing documents.zip archive.
  • zip -mT documents *
    Moves all files of the current directory to the documents.zip archive. This is dangerous as this actually deletes those files. Please read the man page for more details.

No comments: