Zip a file with no extension


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu Zip a file with no extension
# 8  
Old 04-04-2019
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.

Last edited by drew77; 04-04-2019 at 02:58 PM..
# 9  
Old 04-04-2019
Quote:
Already tried that. It's in my 1st post.
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:
Code:
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".

Last edited by Corona688; 04-04-2019 at 03:25 PM..
This User Gave Thanks to Corona688 For This Post:
# 10  
Old 04-04-2019
Thanks. Most of my files are relatively small.
# 11  
Old 04-05-2019
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
# 12  
Old 04-05-2019
Code:
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

# 13  
Old 04-05-2019
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
This User Gave Thanks to rbatte1 For This Post:
# 14  
Old 04-05-2019
Code:
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'

Code:
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.

Code:
zip -u Ubuntu_Scripts.zip *.sh *.rb *.c *.py *.txt On_Resume*

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

2. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

3. Shell Programming and Scripting

Rename specific file extension in directory with match to another file in bash

I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies

4. UNIX for Dummies Questions & Answers

Display the .csv extension files based on .done extension fine

Hi All, I want to fetch the files based on .done file and display the .csv files and Wil take .csv files for processing. 1.I need to display the .done files from the directory. 2.next i need to search for the .Csv files based on .done file.then move .csv files for the one directory ... (2 Replies)
Discussion started by: girija.g6
2 Replies

5. Shell Programming and Scripting

Zip Multiple files to One .zip file in AIX system

Hi I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want. One I do .zip file, I should be able to unzip in my local Computer. Here is example what I want... (9 Replies)
Discussion started by: RAMA PULI
9 Replies

6. UNIX for Dummies Questions & Answers

archieve and zip the multiple file with no extension

Hi, I'm new to scripting. I need to find all the 10 files in the source directory and then archieve them to archive directory. The source files which im getting does not have any extensions just binary files. I need to find them by the file names and archive it. Directory also contains other... (1 Reply)
Discussion started by: etldeveloper
1 Replies

7. UNIX for Advanced & Expert Users

Zip file inside Zip file(s)

I've a zip file called Z00.zip and in that file there are 22 more zip files. Each zip file having .txt files nearly 10,000 files. I am trying to unzip all these .txt files in one command line to unzip each .zip file from Z00.zip file. Would like to know whether possible to unzip all sub-zip files... (1 Reply)
Discussion started by: nvkuriseti
1 Replies

8. UNIX for Dummies Questions & Answers

Zip a file with .zip extension.

Hi, I need to zip a .dat file with .zip extension. I tried using the "zip" command. But shell says. "ksh: zip: not found" Currently I am using gunzip to zip and changing the extension ".gz" to ".zip" as follows. mv $file `echo $file | sed 's/\(.*\.\)gz/\1zip/'` But when I tried... (1 Reply)
Discussion started by: aeroticman
1 Replies

9. AIX

ZIP multiple files and also specify size of zip file

I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created. How we can achieve this in UNIX? I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Discussion started by: tom007
1 Replies

10. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies
Login or Register to Ask a Question