I want to compress the contents of stdin using zip
, for instance:
echo 'foo bar' | zip > file.zip
This works ok, but when unzipping, the uncompressed file name is -
I was wondering how I could specify a file name for stdin?
To place multiple files into a zip folder, select all of the files while hitting the Ctrl button. Then, right-click on one of the files, move your cursor over the “Send to” option and select “Compressed (zipped) folder”.
“rename zip file in linux” Code Answer To use mv to rename a file type mv , a space, the name of the file, a space, and the new name you wish the file to have.
If you open a terminal console in the parent directory, or used the cd command to navigate there from the command line, you should then be able to run the command on the folder. The syntax is ' zip -r <zip file name> <directory name> '. The '-r' option tells zip to include files/folders in sub-directories.
In order to zip multiple files using the zip command, you can simply append all your filenames. Alternatively, you can use a wildcard if you are able to group your files by extension.
What you can do is pipe the file in normally, then rename it in the zip
echo 'foo bar' | zip > file.zip printf "@ -\n@=filename.txt\n" | zipnote -w file.zip
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