Help with tar cmd for directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with tar cmd for directories
# 1  
Old 03-02-2018
Help with tar cmd for directories

Hi, I'm working on HP-UX B.11.23 64bit. I tried to tar couple of directories but failed to do so.
$ tar -cvf tar_file_name -C /dir1 /dir2

the -C is for directories as mentioned in the man pages. But still unable to create a tar file having directories and sub-directories.
Requesting help in this regard.
# 2  
Old 03-02-2018
Code:
$ tar -cvf tar_file_name -C /dir1 . -C /dir2 .

Note the <space> between /<dir> and .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using tar to move directories

I have figured out how to create a tar file that holds all the files in a particular directory. The plan is to move the tar to a new system via FTP so that we can test the new system with our files and libraries. What I can't figure out is how to unzip the tar file; I keep getting messages that... (8 Replies)
Discussion started by: KathyB148
8 Replies

2. UNIX for Advanced & Expert Users

Extracting directories only from tar ball

Hi Somebody must have done this before, but I can't seem to find any answer on my problem. On HP-UX 11i v3 I have a relatively large tar ball (~120 GB), and I want to create the directory structure only from the archive. There is no option to make a new archive with only the directory... (3 Replies)
Discussion started by: hpvm_adm
3 Replies

3. Red Hat

multi tape option in tar cmd

Dear experts, I have to take back up of 1.8TB data in single cmd. I have tape which has the capasity of 600 GB. Hence i want to use multiple tapes to take the backup using tar cmd. Kindly help. -Anand (8 Replies)
Discussion started by: nithyanandan
8 Replies

4. Shell Programming and Scripting

tar cmd how many arguments into parameters of filenames

Hi I would like to use tar cmd in my script. I have a variable with filenames, e.g. 1000 records and I would like to paste its values into tar cmd. For this example I used three elements variable strings. strings="file1.txt file2.txt file3.txt" `tar cf file1.tar $strings` Whether... (1 Reply)
Discussion started by: presul
1 Replies

5. UNIX for Dummies Questions & Answers

Tar only the Directories and Sub Directories

Hi all, I want to only tar the Directories and the Sub Directories. I dont want the files which are created in those directories. Can you please help me out in this issue. Regards Andy (3 Replies)
Discussion started by: Andysundar
3 Replies

6. Solaris

Tar and moving directories

I'm redoing my file system partitions on a Sunblade 100. The system came with a 999mb root and slice 6 with 35GB. I redid the file system by creating separate /opt1, /usr1, /var1, and a /data on different partitions (slice 3, 4, 5 and 7). I need a command to tar my opt, var, opt, usr that's under... (2 Replies)
Discussion started by: stocksj
2 Replies

7. UNIX for Dummies Questions & Answers

how to tar directories that begins with 'sample_ZZZ'????

Hi, I have a bunch of images (8k) in several directories. I want to tar these directories up and unzip them to development and production with the same path. Example: /about/images/sample_01 /about/images/sample_02 /about/images/sample_03 /about/images/lorem_ipsum... (4 Replies)
Discussion started by: andylee80
4 Replies

8. Shell Programming and Scripting

cmd to view only directories

Hi All, Plz tell me the cmd of viewing only directories. Suppose i am at bin directory and it contains another directory mails with lotz of files in it. Now when ever I do ls -lt mails under bin directory it shows me all the files inside mails dir . But I just want to see only mails... (14 Replies)
Discussion started by: aarora_98
14 Replies

9. Shell Programming and Scripting

excluding directories in tar

In a bash script I am writing I am having a problem excluding selected directories from tar. From the machine $SERVER I issue the command #start netcat on storage server gnetcat -l -vv -p 2011 >$FILEPATH/$SHORT_NAME.$today.tar & The the following command is then sent to the $CLIENT. #start... (2 Replies)
Discussion started by: thumper
2 Replies

10. UNIX for Dummies Questions & Answers

excluding directories while using tar

How do I exclude some directories while creating a tar file with a number of directories? thanks. (2 Replies)
Discussion started by: uchachra
2 Replies
Login or Register to Ask a Question