Zipping of file in a different directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Zipping of file in a different directory
# 1  
Old 02-03-2010
Zipping of file in a different directory

Hi,
I am having some problem with a shell script which zip some files. For zipping I have used the following command:
Code:
find . -name "Test_*" -mtime 0 | zip Test_$(date +"%Y%m%d") -@

I have kept the script in /home/abc directory. It is creating the zip file within the same directory where i have kept the script. How can I create those zip files in another directory(suppose /home/xyz)? Please help me..

Last edited by vbe; 02-03-2010 at 05:09 AM.. Reason: code tags
# 2  
Old 02-03-2010
Code:
find . -name "Test_*" -mtime 0 | zip /home/xyz/Test_$(date +"%Y%m%d") -@

# 3  
Old 02-03-2010
Thanks a lot..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Zipping contents without the actual directory

Hi , I want to zip files present in the directories listed under a parent directory without zipping the directory itself my parent directory path is /informatica/DGDMN/PowerCenter1011/server/infa_shared/SrcFiles/OTE/Final_Directory I have the below directories named as 1,2,3,4,5 listed... (9 Replies)
Discussion started by: paul1234
9 Replies

2. Shell Programming and Scripting

Zipping file issues

Hi All, I am trying to zip a file but facing the issue. I have three zip files. a_1.zip a_2.zip c.zip I want to add a_1.zip and a_2.zip to c.zip Code: ############### for i in a*.zip; do printf "%s\n" "$i" done | zip -@ c.zip (2 Replies)
Discussion started by: weknowd
2 Replies

3. UNIX for Dummies Questions & Answers

Zipping the logs of directory

Hi Folks, I have logs at the following location cd /out/app/logs/ now that logs directory contain different types of logs now sometimes i need to do disk clean up activity so i need to zipped the logs can you please advise any command by which all the logs created in this directory are... (2 Replies)
Discussion started by: punpun66
2 Replies

4. UNIX for Dummies Questions & Answers

Deleting a directory and zipping another directory

Hi Folks, I have a directory in unix that is /usr/local/pos contain the folowing directoreis ..that is dir1 dir2 dir3 now I want to delete only dir2 please advise how to remove the directory dir 2 ..that is rm command and how to use it , and second if I want to zip the dir3 please... (1 Reply)
Discussion started by: punpun66
1 Replies

5. UNIX for Dummies Questions & Answers

Help With zipping a file

Hi I need to zip a file and move it into another folder along with the timestamp. The orginal file must be removed from the source directory Source : folder1/source12.txt folder2 After zipping Folder1/Folder2/source12.zip Any help will be greatly appreciarted ... (5 Replies)
Discussion started by: akshay01987
5 Replies

6. Shell Programming and Scripting

Zipping a directory and extracting to another server.

Hello everyone, I am trying to make a script in KSH that will zip an entire directory but leave out one file in that directory. I then need to send that zipped directory to another UNIX box. I am new to UNIX and would appreciate a good template to study from. (3 Replies)
Discussion started by: BrutalBryan
3 Replies

7. Shell Programming and Scripting

grep a file and zipping it

Hi, In my process iam creating a temporary filelist with filename and date(yyyy-mm-dd format).I need to search file for a date and zip. Below command is giving the filename ,can someone helpme how to add the zip or gzip command to this statement. grep 2010-11-11 filelist.log | awk... (1 Reply)
Discussion started by: swathich
1 Replies

8. Shell Programming and Scripting

zipping a directory when the file count is over $X

Hiya, I've been plugging away at this script and I cant get it to behave as I need. first off it fails to adhere to the conditions of the file limit, and zips the directory regardless of the file count and secondly, but less important it zips up the entire path not just the directory I'm... (2 Replies)
Discussion started by: orionrush
2 Replies

9. UNIX for Dummies Questions & Answers

zipping all the tar files to singlr file in directory

Hi, i have more than 300 tar files in directory and i want to zip all tar files to single file. could anybody tell me the command since i know how to do zip for single tar file: bash-3.00$gzip 2008_11_10.tar bash-3.00$ pwd /oracle1/archivebackup in this directory i have lot files... (2 Replies)
Discussion started by: prakash.gr
2 Replies

10. UNIX for Advanced & Expert Users

Help me While zipping the file

Hi , I have written code which will ask the subject,body of the mail, attachment and mail id of the receipient. Code will pick up 4 files zip it. It will zip all the files and then post the mail to the receipient. While zipping the file i am getting error. Can anyone help me with this. ... (7 Replies)
Discussion started by: Jolly
7 Replies
Login or Register to Ask a Question