To tar the content while copying files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To tar the content while copying files
# 1  
Old 06-11-2012
To tar the content while copying files

Any idea on how we can tar the content while copying the files from one location to another location using the bash script.
# 2  
Old 06-12-2012
If you want to store tar contents of directory ./XYZ and all files/directores under it to /path/to/dest/XYZ.tar use:

Code:
tar cf /path/to/dest/XYZ.tar  ./XYZ

Example contents of /path/to/dest/XYZ.tar tarfile might be:

Code:
./XYZ/.profile
./XYZ/.kshrc
./XYZ/save.ksh
./XYZ/ZZZ
./XYZ/ZZZ/testing.c
./XYZ/ZZZ/testing.o

# 3  
Old 06-12-2012
Thanks...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Linux read specific content file from tar.gz files without extracting

hello i wish to write the result of these below conditions in a file: 1. in a specific folder, i have many tar.gz files. 2. each tar.gz file contains ".dat" file in sub folders. 3. i wish to get the full path of these .dat files, if i find in it a specific word ("ERROR24"). 4. all this... (6 Replies)
Discussion started by: jimmyjames9
6 Replies

2. Shell Programming and Scripting

Copying all the .sh files into a tar file

Hi All , I need to tar all the .sh files in a server along with the path . Please let me know is there any way this can be accomplished . Need to grep through all the directories and sub directories in a server and tar all the .sh scripts . (16 Replies)
Discussion started by: saj
16 Replies

3. Shell Programming and Scripting

Shell :copying the content from one file to another

I have a log containing the below lines. file1.log ----------- module: module1 module10 module2 module002 module9 moduleRT100.2.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... (1 Reply)
Discussion started by: giridhar276
1 Replies

4. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

5. Solaris

Copying the content of a filesystem to different Harddrive

my server runs solaris 10 , one of the partition in my primary harddrive is 99% full , i want to move the contents of it to the second harddrive which has higher capacity. what is the best way to move the contents to 2nd drive ? which command should i use cpio/dd/tar/ufsdump .... please guide me... (1 Reply)
Discussion started by: skamal4u
1 Replies

6. UNIX for Dummies Questions & Answers

Copying the content of a filesystem to different Harddrive

my server runs solaris 10 , one of the partition in my primary harddrive is 99% full , i want to move the contents of it to the second harddrive . what is the best way to move the contents to 2nd drive ? which command should i use cpio/dd/tar/ufsdump .... please guide me with the command and the... (0 Replies)
Discussion started by: skamal4u
0 Replies

7. AIX

copying files to a remote aix server using tar!

Hi, I am using AIX 5.2, and I want to copy some files from one server to a remote server using tar command. Can anybody tell me exact command? Thanks. Aqeel (2 Replies)
Discussion started by: system-admin
2 Replies

8. Shell Programming and Scripting

Copying selected content from file

I want to capture contents of a file between 2 strings into another file for eg all lines in between the keywords "start log" and "end log" should be copied into another file (1 Reply)
Discussion started by: misenkiser
1 Replies

9. UNIX for Dummies Questions & Answers

copying content of a file

Hi, I have a file in my unix system let's call it FileName. First I want to copy its content into a another file, but outside of the unix, meaning I could open it at home. (text file would be perfect) Second (if it's possible) I need to take the first word of each line in the file (you know... (2 Replies)
Discussion started by: talzohar
2 Replies
Login or Register to Ask a Question