Copy Folders and ZIP IT


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy Folders and ZIP IT
# 1  
Old 02-19-2013
Copy Folders and ZIP IT

HI All

I have one master folder : ABCXYZ

I have sub folder in there :

AB
XY
AZ
AC
PR
AL

Now i want to copy AB , PR ,AL in to one new folder and zip it with time stamp.

like

Pre_02192013_12_32.zip

Zip folder should be in master folder.

/home/ABCXYZ/Pre_02192013_12_32.zip

Thanks
# 2  
Old 02-19-2013
Code:
TIME=$(/bin/date +"%m%d%Y_%H_%M")
tar zcvfP /home/ABCXYZ/Pre_$TIME.tar.gz /home/ABCXYZ/AB/* /home/ABCXYZ/PR/* /home/ABCXYZ/AL/* > /dev/null &&


Last edited by Jotne; 02-19-2013 at 03:54 PM..
This User Gave Thanks to Jotne For This Post:
# 3  
Old 02-19-2013
What have your tried?

This is a fairly straight-forward problem.
What have you tried?
What did not work?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Tar.gz/zip folders in a directory with _EBASE string

Hi Folks - Happy Friday and I hope you all are well! What's the easiest way to tar.gz / zip all direct children directories in a folder that have the string _EBASE (suffix)? Thank you! (6 Replies)
Discussion started by: SIMMS7400
6 Replies

2. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies

3. Shell Programming and Scripting

Gunzip,grep and zip across folders in a subdirectory

I have a simple function that greps within a folder into files that are already gunzipped. This was already written for me so from my understanding fn=$1 specifies that it will look into any file in that folder that is gunzipped and the rest of the script greps the data its looking for and puts it... (3 Replies)
Discussion started by: red56
3 Replies

4. Shell Programming and Scripting

How to auto zip all folders?

Hi, How do I write a script that will automatically find and zip any folder to the same name in a directory and affected recursively?. The zip file should be place in the same directory where the source folder is. Help is appreciated. Thanks in advance. ex: Orange Crayon Blue Crayon... (5 Replies)
Discussion started by: Frozen77
5 Replies

5. Shell Programming and Scripting

Need to copy all but three folders

Hi, Below is the listing of folder "greece" $ cd greece $ ls tmp server logs properties I wish to copy all the contents of the dir "greece" to /tmp except the below three folders and its contents under "greece" 1.logs 2.server/bin/logs 3. server/cacheI am using sh (normal C... (4 Replies)
Discussion started by: mohtashims
4 Replies

6. Shell Programming and Scripting

Copy between two different folders containing same sub-folders

I have a folder like this ls input1 dir1 dir2 dir3 file1 file2 file3 dir1, dir2 and dir3 are sub-folders inside the folder input1 ls input2 dir1 dir2 dir3 file1 file2 file3 My dir1 in input1 folder has files f1, f2, f3 and f4. My dir1 in input2 folder has file f4 and f5. ... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

7. UNIX for Dummies Questions & Answers

Zip multiple files and copy to help

Hi All, I have a set of large files ~ 500_900Mb I have generated and I'd like to quickly zip and copy them to a new folder elsewhere ... Can anyone suggest a quicky ?? Cheers :) (3 Replies)
Discussion started by: pawannoel
3 Replies

8. Shell Programming and Scripting

Help with auto-detect new files/folders then zip and move script

Hello, I need a simple script to Auto-detect new files and folders in the directory. And then I need to zip the new files and bzip2 new folders and move them out of that folder where I am detecting changes to the other folder. Remember, I need simple one. If anyone could do it fast, I may... (1 Reply)
Discussion started by: juzt1s
1 Replies

9. UNIX for Dummies Questions & Answers

Zip a folder including its sub-folders.

Hi, I have a folder that contains a few sub-folders. I would like to zip that folder and KEEP the subfolders. What it does at the moment is taking all the files within the subfolders and zipping them into one big file (zip -r ...). Does anyone know the UNIX command to keep the subfolders in the... (3 Replies)
Discussion started by: gdog
3 Replies

10. UNIX for Dummies Questions & Answers

zip nesting empty folders

I'm using the following command to zip a project file, but when it finishes, the resulting zip file contains all the directories above the file I wanted zipped, myapp.app, each one empty until you get to the actual app. zip -r myapp.app.zip ... (0 Replies)
Discussion started by: groundlevel
0 Replies
Login or Register to Ask a Question