I am getting the following error while using zip in my bash script
zip warning: name not matched: test.png test2.png
#!/bin/bash
files_to_zip="test.png test2.png"
zipfile_name=result$(date "+%Y.%m.%d-%H.%M.%S").zip
zip "$zipfile_name" "$files_to_zip"
Note: The images are in the same directory as the script and when i execute zip test.zip test.png test2.png
, the zip get created just fine.
zip "result-2017-09-02.zip" "test.png test2.png"
this is different from what you want to achieve – Caterpillartest.zip
for simplicity – Brittani$files_to_zip
contain list of files as a string separated by spaces so zip should know they are different filenames – Brittanizip test.zip "test.png test2.png"
? If you sure zip has to understand it – Caterpillarzip "$zipfile_name" $files_to_zip
and if you have special chars or spaces inside the names - add quotes inside the files_to_zip variable – Caterpillar--symlinks
– Scag