/media/bill/PROJECTS/System_maintenance/Linux/zip, gzip notes.txt ************** 11May2019 search "Linux zip and how do I zip selected files?" https://stackoverflow.com/questions/1112468/how-do-i-zip-a-whole-folder-tree-in-unix-but-only-certain-files You can use find and grep to generate the file list, then pipe that into zip find . | egrep "\.(html|css|js|php)$" | zip -@ test.zip (-@ tells zip to read a file list from stdin) shareimprove this answer edited Feb 20 '15 at 16:18 answered Jul 11 '09 at 0:02 Nick I'll try for "/media/bill/SWAPPER/bin/pdf edits/pdf zip all papers.sh" : "/media/bill/SWAPPER/bin/pdf edits/pdf header.sh" : d_copyrighted="$d_base""all - copyrighted/" "/media/bill/SWAPPER/bin/pdf edits/pdf zip all papers.sh" : find "$d_copyrighted" -name "19000-19299]*" | zip "$d_base""$dated""IJCNN2019 papers 19000-19299.zip" tests : $ d_copyrighted="/media/bill/SWAPPER/2019 IJCNN Budapest/papers/all - copyrighted/" $ d_base="/media/bill/SWAPPER/2019 IJCNN Budapest/papers/" $ cd "$d_copyrighted" $ find "$d_copyrighted" -maxdepth 1 -type f -name "N-19[012]*" | sort $ find . -maxdepth 1 -type f -name "N-19[012]*" | sort | zip -@ "$d_base""$dated""IJCNN2019 papers 19000-19299.zip" >> OK Now for tougher 19900-20299 : $ find . -maxdepth 1 -type f -name "N-\(199\)*" >> doesn't work, but is POSIX? Fudge it p_zipList="$d_temp""papers to zip.txt" find . -maxdepth 1 -type f -name "N-199*" >"$p_zipList" find . -maxdepth 1 -type f -name "N-20[01]*" >>"$p_zipList" cat "$p_zipList" | sort | zip -@ "$d_base""$dated""IJCNN2019 papers 19900-20199.zip" ****************** 11May2019 search "Linux find and how do I specify a range of filenames?" https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux#16957078 ****************** 17Apr2019 search "Linux zip and how do I zip directories" https://superuser.com/questions/214390/zipping-folders-and-their-contents-into-a-zip-file-in-linux How do I make a .zip file that contains every file AND every folder in the directory? linux zip asked Nov 23 '10 at 3:37 sdfhdfgujsdfbgdfsb +-----+ zip -r foo.zip dir_path answered Nov 23 '10 at 3:41 Wesley Rice https://stackoverflow.com/questions/31342963/in-linux-zip-multiple-directories-in-one-named-zip-file try zip -r backup.zip /home/users/jlefler/files /opt/software/reports/files you can add more directories at the end of the command answered Jul 10 '15 at 14:20 Kiril Ivanov +-----+ man gzip ADVANCED USAGE Multiple compressed files can be concatenated. In this case, gunzip will extract all members at once. For example: gzip -c file1 > foo.gz gzip -c file2 >> foo.gz Then gunzip -c foo is equivalent to cat file1 file2 In case of damage to one member of a .gz file, other members can still be recovered (if the damaged member is removed). However, you can get better compression by compressing all members at once: cat file1 file2 | gzip > foo.gz compresses better than gzip -c file1 file2 > foo.gz If you want to recompress concatenated files to get better compression, do: gzip -cd old.gz | gzip > new.gz If a compressed file consists of several members, the uncompressed size and CRC reported by the --list option applies to the last member only. If you need the uncompressed size for all members, you can use: gzip -cd file.gz | wc -c If you wish to create a single archive file with multiple members so that members can later be extracted independently, use an archiver such as tar or zip. GNU tar supports the -z option to invoke gzip transparā€ ently. gzip is designed as a complement to tar, not as a replacement. . +-----+ https://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux How to create a zip file compatible with Windows under Linux In addition to what others suggested, it's important pay Attention to your file and directory names as Windows does not necessarily like Linux file path and names. It sometimes also escapes them differently when zipping. Examples are numerous, but most importantly dot files (. and ..), files with only case differences (name.txt and NAME.txt), absolute file paths (/tmp/file.txt). Some other characters which are allowed in file names on Windows could cause issues when Windows Explorer is used to open files. In my case ':' character was the deal breaker but took a lot of work to find this out. So before you resume to using using a lot of parameters, I suggest follow a simple procedure: Locate the folder or file your zipping up. run: zip -9 -r -k zip-modified-names.zip /path/to/your/folder pay attention to what the console spits out. In my case ':' in file names were stripped out. Move the zip file to a windows machine and attempt to open it. If this works, you may be better off removing the characters that have been stripped off by -k option from your file/directory names try zipping normally. Note some parameters such as -k have side effects. In this case -k contradicts with -q option (for sym links). Also -k option may render your file names unreadable. In my case my files were named based on creation time (e.g. 10:55:39.pdf) to facilitate easily locating the required record from archives, but -k option turned it to 105539.pdf which is not easily readable by users. I hence changed the names to 10_55_39.pdf which opens on Windows without using -k option but is still readable. answered Jun 19 '15 at 5:50, Shakus # enddoc