I would like to include in my zip file a particular file name On_Resume which has no file extension.
This does not work.
zip -u Ubuntu_Documents.zip *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.png *.xls On_Resume*
I would like to include in my zip file a particular file name On_Resume which has no file extension.
This does not work.
zip -u Ubuntu_Documents.zip *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.png *.xls On_Resume*
$ touch on_resume
$ zip -u something.zip on_resume*
$ unzip -l something.zip
Archive: something.zip
Length Date Time Name
--------- ---------- ----- ----
0 04-04-2019 09:08 on_resume
--------- -------
0 1 file
$
In what way does it "not work"? I suspect it has nothing to do with the extension and more to do with the file not matching your expression.
Hi drew77...
And to add to Corona688's reply you have "*.png" twice.
Just an observation.
andy@7_~/bin$ ls On*
On_host.sh On_Resume
andy@7_~/bin$
What is even stranger is that it zips up a On_Resume.sh which is not even present in the directory or anywhere else?
Update:
On_Resume is a script, so I added the sh extension. Problemo solved.
Why are you appending a * for a file you give its full name? I could understand On_Re* ...
Removed the *.
No change.
Even tried it with other no extension files.
Maybe it's a conspiracy.
On a lark, try:
echo zip -u Ubuntu_Documents.zip *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.png *.xls On_Resume*
Which will at least solve the question of whether it's being expanded wrong, or zip itself is revolting here...
Already tried that. It's in my 1st post.
I could consider other compression programs.
Tar works. Have to give zip the heave ho.
tar cvf archive_name.tar *.sh On_Resume
Size is double, maybe there is a better compression mode.
Sorry, I don't see it. Could you link to where you answer the question?
My final wild guess is there's some odd filename in there which zip is taking to be a commandline switch instead of a file.
Anyway, tar isn't compressing at all, but can if you ask it to:
tar -zcvf archive_name.tar.gz filenames
One drawback of tar is that it can't "seek" the way zip can. It doesn't have a table of contents. Extracting one specific file, from a tarball of 2 gigabytes, means scanning through as much of that 2 gigabytes as it takes to find it. This has other advantages, like being able to extract from a stream in progress, which is the whole point of course - "tape archive".
Thanks. Most of my files are relatively small.
There could be a filename with space in it. That could cause a mess.
Would you be so good as to either post the output (i.e. the echo in front of your command) or the output of ls -lid *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.xls On_Resume*
The d flag might show us if you are trying to zip a directory, which might also cause an unexpected issue.
Thanks, in advance,
Robin
18351179 -rw-rw-r-- 1 andy andy 10434 Mar 11 22:17 #10_Envelope_With_Sender_Address.odt
18351660 -rw-rw-r-- 1 andy andy 61440 Mar 21 15:36 2019-excel-calendar-planner-12.2.xls
18352704 -rw-r--r-- 1 andy andy 20992 Feb 19 2016 5160_LABEL_2_And_5_eights_X_1_inch.doc
18352705 -rw-rw-r-- 1 andy andy 27972 Feb 28 09:57 6_Ways_God_Blesses_A_Broken_Heart.odt
18352706 -rwxrwxr-x 1 andy andy 12544 Sep 4 2018 AA_Log.odt
18352710 -rwxrw-r-- 1 andy andy 15191 Mar 21 21:25 Beacon_Check_Register.odt
18352713 -rw-rw-r-- 1 andy andy 10001 Sep 10 2017 Blank_Bus_Card_8371.odt
18352712 -r--r--r-- 1 andy andy 9940 Apr 5 05:06 Blank.odt
18353244 -rw-rw-r-- 1 andy andy 0 Feb 20 11:48 blank.txt
18352714 -rw-rw-r-- 1 andy andy 35246 Mar 11 13:18 Blood_Sugar_Log.odt
18352709 -rw-rw-r-- 1 andy andy 13894 Jun 6 2018 BLUE_JSC_Check_Register.odt
18359900 -rw-r--r-- 1 andy andy 145916 Apr 5 05:06 bookmarks.html
18351068 -rw-rw-r-- 1 andy andy 9631 Mar 20 03:28 bookmarks_VERY_IMPT.txt
18350425 -rw-rw-r-- 1 andy andy 3120 Mar 28 08:06 Bootup_Log.txt
18350543 -rw-rw-r-- 1 andy andy 11415 Feb 26 13:05 Buggy_Programs.odt
18352717 -rw-rw-r-- 1 andy andy 38887 May 9 2017 Bus_Card_8371.odt
18351518 -rw-rw-r-- 1 andy andy 42 Mar 19 19:09 Carbohydrate_Goal.txt
18352722 -rw-rw-r-- 1 andy andy 79323 Dec 25 2017 Covert_Resize_Cut_Videos_With_VLC.odt
18352719 -rwxrw-r-- 1 andy andy 29805 Oct 18 2017 CX7_Maintenance_Log.odt
18352723 -rw-rw-r-- 1 andy andy 14703 Feb 28 13:53 Diabetes_Info.odt
18351261 -rw-rw-r-- 1 andy andy 170 Mar 26 17:31 el_lago.txt
18351480 -rw-rw-r-- 1 andy andy 187 Mar 19 16:33 Email_Accounts_IMPT.txt
18352865 -rw-rw-r-- 1 andy andy 83902 Jan 2 2018 Extra_Bookmarks.html
18351149 -rw-rw-r-- 1 andy andy 13215 Mar 12 10:23 FitBit_Log.odt
18351707 -rw-rw-r-- 1 andy andy 179 Mar 23 16:50 Fitbit_Versa_Tips.txt
18352905 -rw-rw-r-- 1 andy andy 13344 Apr 7 2017 Food_Diary.odt
18352907 -rw-rw-r-- 1 andy andy 20182 Apr 24 2017 Food_Portions.odt
18352904 -rw-rw-r-- 1 andy andy 23073 Mar 21 15:04 FOOD_RECIPES.odt
18352910 -rw-rw-r-- 1 andy andy 24120 Aug 31 2018 Gimp_TIPS.odt
18352911 -rw-rw-r-- 1 andy andy 30167 Nov 8 2017 Gods_Attributes.odt
18353056 -rw-rw-r-- 1 andy andy 35086 Oct 18 2017 Gods_Remedy_For_Sin.odt
18351049 -rw-rw-r-- 1 andy andy 14452 Mar 6 06:04 Good_ bible_ verses.odt
18350205 -rw-rw-r-- 1 andy andy 12623 Feb 25 19:43 Good_Food_Condiments.odt
18353061 -rw-rw-r-- 1 andy andy 13787 Jun 15 2017 Harold_Strege.odt
18353070 -rw-rw-r-- 1 andy andy 24304 Nov 15 2017 Healthy_Diet.odt
18350775 -rw-rw-r-- 1 andy andy 13316 Feb 27 21:02 Healthy_Habits.odt
18353097 -rw-rw-r-- 1 andy andy 13900 Jan 25 2018 Healthy_Ready_Made_Food.odt
18353098 -rwxrw-r-- 1 andy andy 64231 Mar 21 21:39 Homemade_Recipes.odt
18351907 -rw-rw-r-- 1 andy andy 13105664 Apr 1 19:54 Hope_Journal.doc
18353112 -rwxrw-r-- 1 andy andy 12718265 Apr 4 15:00 Hope_Journal.odt
18353059 -rw-rw-r-- 1 andy andy 41107 Aug 26 2018 HP_Keys.odt
18352699 -rw-rw-r-- 1 andy andy 26116 Jul 26 2018 Impt_APC_Battery_Backup_Info.odt
18350430 -rw-rw-r-- 1 andy andy 3374 Feb 26 03:21 IMPT_Firefox_INFO.txt
18353118 -rwxrw-r-- 1 andy andy 267290 Mar 28 22:49 Impt_Ubuntu_Tips.odt
18353120 -rw-rw-r-- 1 andy andy 13357 Apr 4 13:24 Interlock_Log.odt
18353123 -rwxrw-r-- 1 andy andy 24862 Jan 7 2018 Jokes.odt
18353122 -rwxrw-r-- 1 andy andy 16387 Mar 13 00:39 JSC_Check_Register.odt
18353125 -rw-rw-r-- 1 andy andy 20497 Apr 8 2017 LAb_Results.odt
18353126 -rw-rw-r-- 1 andy andy 9495 Jun 7 2018 Landscape_Blank.odt
18353128 -rw-rw-r-- 1 andy andy 22643 Aug 9 2018 Linux_Date_Info.odt
18353129 -rw-rw-r-- 1 andy andy 11459 Aug 9 2018 Log.odt
18353130 -rw-rw-r-- 1 andy andy 10956 Dec 12 15:01 MEDS_THAT_DONT_WORK.odt
18353132 -rw-rw-r-- 1 andy andy 12741 Jul 11 2017 Miles_Per_Gallon.odt
18353131 -rw-rw-r-- 1 andy andy 11213 Jun 24 2017 MOVIES_WORTH_BUYING.odt
18353133 -rw-rw-r-- 1 andy andy 12359 Jul 1 2018 No_No_Food_List.odt
18353135 -rw-rw-r-- 1 andy andy 50521 Dec 30 2017 Onboard.png
18353138 -rw-rw-r-- 1 andy andy 26668 Nov 16 2017 Panasonic_NCR18650B_3400_mAh_Battery.odt
18353139 -rw-rw-r-- 1 andy andy 27295 Aug 26 2018 Personal_Injury_Claim.odt
18353140 -rw-rw-r-- 1 andy andy 28385 Aug 15 2018 Personal_Labels.odt
18353141 -rwxrw-r-- 1 andy andy 16652 Oct 11 12:40 Phone_List.odt
18353142 -rw-rw-r-- 1 andy andy 22661 Apr 21 2017 Please_Return.odt
18353143 -rw-rw-r-- 1 andy andy 17394 Feb 19 22:49 Postal_Package_Notice.odt
18353146 -rw-rw-r-- 1 andy andy 12431 Oct 13 2017 Prayer_Requests.odt
18353151 -rw-rw-r-- 1 andy andy 114176 Aug 12 2018 QHR_CARD.doc
18353152 -rw-rw-r-- 1 andy andy 28639 Aug 9 2018 QHR_CARD.odt
18353153 -rw-rw-r-- 1 andy andy 29965 Aug 7 2018 QHR_CARD.pdf
18353154 -rw-rw-r-- 1 andy andy 10170 May 28 2017 Red_Boxes_For_Notes.odt
18353155 -rw-rw-r-- 1 andy andy 28502 Aug 7 2018 Single_QHR_CARD.pdf
18351028 -rw-rw-r-- 1 andy andy 28181 Mar 5 22:57 Swappiness.odt
18353157 -rw-rw-r-- 1 andy andy 12050 Nov 28 2017 Tasty_Nutritional_Foods.odt
18353158 -rw-rw-r-- 1 andy andy 2269644 Jul 26 2018 TheLinuxCommandLine.pdf
18356757 -rw-rw-r-- 1 andy andy 20358 Feb 24 16:43 Thunderbird_Attempt_At_Setup.odt
18351364 -rw-rw-r-- 1 andy andy 16228 Mar 16 17:29 UHC_Appeal.pdf
18353161 -rw-rw-r-- 1 andy andy 87338 Nov 16 2017 Why_Keep_Praying_When_You_Dont_See_Results.odt
18353162 -rw-rw-r-- 1 andy andy 146908 Apr 18 2017 Willed_Body_Program.pdf
18353163 -rw-r--r-- 1 andy andy 17608 Jan 12 2017 Yahoo Advanced Web Search.html
Thank you for the output. There are at least two I've spotted which may cause you problems - Yahoo Advanced Web Search.html
and Good_ bible_ verses.odt
Can you show us what happens when you try your code?
Oddly, there are no files that start On_Resume*
at all. Are you in the correct directory?
Thanks,
Robin
ls
'#10_Envelope_With_Sender_Address.odt'
2019-excel-calendar-planner-12.2.xls
5160_LABEL_2_And_5_eights_X_1_inch.doc
6_Ways_God_Blesses_A_Broken_Heart.odt
AA_Log.odt
Beacon_Check_Register.odt
Blank_Bus_Card_8371.odt
Blank.odt
blank.txt
Blood_Sugar_Log.odt
BLUE_JSC_Check_Register.odt
bookmarks.html
bookmarks_VERY_IMPT.txt
Buggy_Programs.odt
Bus_Card_8371.odt
Carbohydrate_Goal.txt
Covert_Resize_Cut_Videos_With_VLC.odt
CX7_Maintenance_Log.odt
Diabetes_Info.odt
Documents.tar.gz
el_lago.txt
Email_Accounts_IMPT.txt
Extra_Bookmarks.html
FitBit_Log.odt
Fitbit_Versa_Tips.txt
Food_Diary.odt
Food_Portions.odt
FOOD_RECIPES.odt
Gimp_TIPS.odt
Gods_Attributes.odt
Gods_Remedy_For_Sin.odt
'Good_ bible_ verses.odt'
Good_Food_Condiments.odt
Harold_Strege.odt
Healthy_Diet.odt
Healthy_Habits.odt
Healthy_Ready_Made_Food.odt
Homemade_Recipes.odt
Hope_Journal.doc
Hope_Journal.odt
HP_Keys.odt
Impt_APC_Battery_Backup_Info.odt
IMPT_Firefox_INFO.txt
Impt_Ubuntu_Tips.odt
Interlock_Log.odt
Jokes.odt
JSC_Check_Register.odt
LAb_Results.odt
Landscape_Blank.odt
Linux_Date_Info.odt
list.txt
Log.odt
MEDS_THAT_DONT_WORK.odt
Miles_Per_Gallon.odt
MOVIES_WORTH_BUYING.odt
No_No_Food_List.odt
Number_Not_In_Service.mp3
Onboard.png
Personal_Labels.odt
Phone_List.odt
Please_Return.odt
Postal_Package_Notice.odt
Prayer_Requests.odt
QHR_CARD.doc
QHR_CARD.odt
QHR_CARD.pdf
Red_Boxes_For_Notes.odt
Short_Num_Not_In_Service.mp3
Single_QHR_CARD.pdf
Swappiness.odt
Tasty_Nutritional_Foods.odt
TheLinuxCommandLine.pdf
Ubuntu_Documents.tar.gz
Ubuntu_Documents.zip
UHC_Appeal.pdf
Why_Keep_Praying_When_You_Dont_See_Results.odt
'Yahoo Advanced Web Search.html'
zip -u Ubuntu_Documents.zip *.txt *.doc *.rtf *.html *.png *.pdf *.odt *.ods *.odg *.csv *.png *.xls On_Resume*
zip warning: name not matched: *.rtf
zip warning: name not matched: *.ods
zip warning: name not matched: *.odg
zip warning: name not matched: *.csv
zip warning: name not matched: On_Resume*
updating: Blank.odt (deflated 15%)
updating: Hope_Journal.odt (deflated 0%)
updating: Interlock_Log.odt (deflated 11%)
updating: bookmarks.html (deflated 54%)
adding: list.txt (deflated 66%)
Should I take out the spaces from the filenames?
Why are there single quotes around 2 of the files?
--- Post updated at 12:28 PM ---
Sorry, I got mixed up. I was in the wrong directory.
I want to zip up all .sh files as well as On_Resume.
This command below works.
I think you are right in that filenames with spaces cause problems.
I will keep that in mind.
zip -u Ubuntu_Scripts.zip *.sh *.rb *.c *.py *.txt On_Resume*
Files with spaces shouldn't cause problems unless zip does something weird with them, shell globbing always matches whole, unsplit filenames.