I tried to search files and zip them with the following commmand
find . regexpression -exec zip {} \;
however it is not working. How can i do this?
Hold down [Ctrl] on your keyboard > Click on each file you wish to combine into a zipped file. Right-click and select "Send To" > Choose "Compressed (Zipped) Folder."
Zipping zips is fine. If there is a problem, that would be a bug in the compression software :). You will probably not get any further compression for those files though unless you're using a higher level of compression. Zipping a zip can gain you more space even if the compression is the same.
Notes: To add files or folders to a zipped folder you created earlier, drag them to the zipped folder. If you add encrypted files to a zipped folder, they'll be unencrypted when they're unzipped, which might result in unintentional disclosure of personal or sensitive information.
First you send the file you want at the top (mimetype) in the zip file to a compressed(zip) folder. Make sure it is only that file. Than I take the other files i want to zip (two folder in my case) mark them with the cursor and drag them up to the zip file i just created.
The command you use will run zip on each file separately, try this:
find . -name <name> -print | zip newZipFile.zip -@
The -@
tells zip to read files from the input. From man zip(1),
-@
file lists. If a file list is specified as-@
[Not on MacOS], zip takes the list of input files from standard input instead of from the command line.
Your response is close, but this might work better:
find -regex 'regex' -exec zip filname.zip {} +
That will put all the matching files in one zip file called filename.zip. You don't have to worry about special characters in the filename (like a line break), which you would if you piped the results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With