How can I zip all the files in a directory?
I have a bunch of files in a single directory, that I need to have a .zip extension, not .gz, how can I do this without zipping each file individually?
|
If there aren't any subdirectories, you could use
for file in *; do zip "${file}.zip" "${file}" done If there are directories or special files (like sockets or links) you can use find to just handle regular files in the current directory: find ./ -maxdepth 1 -type f -exec zip '{}'.zip '{}' \; |
Many thanks! I would have never figured that out lol.
|
gz extensions are supported by most MS/commercial (un)zippers as well; it shouldn't make much of a difference whether you use zip or gzip. Only bzip2 has more limited support.
|
All times are GMT -5. The time now is 02:18 AM. |