Find all the files under a specific directory and zip them into a single file.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find all the files under a specific directory and zip them into a single file.
# 1  
Old 06-18-2012
Find all the files under a specific directory and zip them into a single file.

Hi,

Is there a way to find all the files from a specific location and then zip them into a single file, even if they are in multiple directories?
# 2  
Old 06-18-2012
What do you mean by :
Quote:
even if they are in multiple directories?
As far as I know, unless you are mixng things with links etc... a file is only at one place, but nothing stops you to have mulitple copies...
# 3  
Old 06-18-2012
if I want to search under /data/raw_files/, there can be multiple directories under raw_files folder. I want to search all the folders recursively and zip those files into a single file. ( there are no duplicates)

thanks,
# 4  
Old 06-18-2012
Is this what you're looking for?

Code:
find /data/raw_files -type f -exec zip -j bundle.zip {} \;

This User Gave Thanks to jawsnnn For This Post:
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. UNIX for Beginners Questions & Answers

How to zip csv files having specific pattern in a directory using UNIX shell script?

I have files in a Linux directory . Some of the file is listed below -rw-rw-r--. 1 roots roots 0 Dec 23 02:17 zzz_123_00000_A_1.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_121_00000_A_2.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_124_00000_A_3.csv drwxrwxr-x. 2 roots roots 6 Dec 23... (4 Replies)
Discussion started by: Balraj
4 Replies

4. Shell Programming and Scripting

Find Large Files Recursively From Specific Directory

Hi. I found many scripts in the web of achieving this. But I like to use this one find /EDWH-DMT03 -xdev -size +10000 -exec ls -la {} \;|sort -n -k 5 > LARGE.rst But the problem is, why it still list out files with 89 bytes as the output? Is there anything wrong with the command? My... (7 Replies)
Discussion started by: aimy
7 Replies

5. Shell Programming and Scripting

Uncompressing .zip file specific directory Fedora 14

Hello, I have Fedora 14 installed on my machine I have a .zip file ( some latex package) which I want to unzip to some location in the Latex paths /usr/share.../texmf/.. so I went to super user mode, created the directory for this package over there, mkdir logo and tried... (1 Reply)
Discussion started by: ajayram
1 Replies

6. Shell Programming and Scripting

Find file and zip without including directory path

Does anyone know of a way to zip the resulting file from a find command? My approach below finds the file and zips the entire directory path, which is not what I need. After scanning the web, it seems to be much easier to perform gzip, but unfortunately the approach must use zip. find `$DIR`... (5 Replies)
Discussion started by: koeji
5 Replies

7. Shell Programming and Scripting

how to find first files in a directory and combine them as a single file?

i have below list of files in a directory. /root/admin/files/file1.txt /root/admin/files/file2.txt /root/admin/files/file3.txt /root/admin/files/pattern.txt /root/admin/files/server.txt i need combine the above text files in the below sequence, file1.txt, pattern.txt,server.txt =>... (8 Replies)
Discussion started by: vel4ever
8 Replies

8. Shell Programming and Scripting

How to find a specific files in a many directory

Dear All, Appreciate some help here. I have a log of report. It located in several directory as below: Directory: mysscpr1 mysscpr2 mysscpr3 my_scnpr4 In the directory it contain hundred of files. i need to find a specific files that contain 'invc2345' in the directory. How... (7 Replies)
Discussion started by: selamba_warrior
7 Replies

9. Shell Programming and Scripting

Find the size of a single specific file

As I'm a newbie to UNIX, very newbie in fact, could anyone humour me and tell me how I'd find just the file size in bytes for a specific file? Or at least just the specific line from the ls -a for the file - call it file1 I know this sounds bad but I don't seem to be getting very far at this... (3 Replies)
Discussion started by: nortypig
3 Replies

10. UNIX for Dummies Questions & Answers

Is extracting specific files from a zip file possible?

If a zip file contains several zip files, but if the file names of the files needed are known, is there a variation of the unzip command that will allow those few (individual) files to be extracted? --- Example: Zip file name: zip.zip unzip -l zip.zip will display file01, file02, file03, etc.... (1 Reply)
Discussion started by: HLee1981
1 Replies
Login or Register to Ask a Question