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


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to tar directories that begins with 'sample_ZZZ'????
# 1  
Old 07-10-2007
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
/about/images/lorem_ipsum2
...
...

How would I tar up all the directories that begin with 'sample_'?

Thanks for your help.
# 2  
Old 07-10-2007
Bug

I'm guessing that all the sample_* directories are under /about/images
cd to the /about/images and the run the following:

Code:
tar cvf sample.tar sample_*

This will create a /about/images/sample.tar file.

View the table of contents of your tar file to see if all the directories and sub-directories are intact:

Code:
tar tvf sample.tar

Run the following on your production or development environment

tar xvf sample.tar
# 3  
Old 07-10-2007
Correct. Let me try and report back. Thanks for your response!
# 4  
Old 07-10-2007
Ok, I was able to the tar the directories correctly however... when I went to un-tar it, i got the following error message:

tar: can't set time on genga_58: Read-only file system
tar: genga_title.html - cannot create
tar: genga_title.pff - cannot create
tar: genga_title.txt - cannot create
tar: zoomifyViewer.js - cannot create
tar: can't set time on genga_title: Read-only file system

i cd to my destination and did the following cmd:

tar -xvf /xxxxxxx/xxxxxxxxxx/genga.tar

Can some one hep with the un-tarring? Thanks!
# 5  
Old 07-10-2007
Bug

Below is my assumption on what is happening and what could be done...

Are you running the below command from the root [/] ? If you are then you need write permissions on the root directory? The below command means that you are trying to extract all the files and directories to the root directory.

tar -xvf /xxxxxxx/xxxxxxxxxx/genga.tar

I would suggest to 'cd' into /xxxxxxx/xxxxxxxxxx/ and run:

tar -xvf genga.tar

This will try to extract your files and directories to /xxxxxxx/xxxxxxxxxx/ where I guess you have the write permission.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: sam_bd
1 Replies

2. Shell Programming and Scripting

Tar extract a multiple directories

i extract it through script, is there any way to script or automate to tar extract a tarfiles in multiple directories at once? Cannot open: No such file or directory tar: Error is not recoverable: exiting now for dir in `ls -d /tarfiles/*/ | sed 's/.$//'` do rm -f $dir/*.tar mv -f... (1 Reply)
Discussion started by: kenshinhimura
1 Replies

3. AIX

Exclude Directories in my tar command

Hi, im having some issues after i execute the next command: tar -cvf /varios/restore/test.tar -X /jfma/test1/excludefile /jfma | gzip -c > /varios/restore/test.tar.gz this creates the desired "test.tar.gz" file, but whe i try to open it it says "tar: 0511-164 There is a media read or write... (6 Replies)
Discussion started by: blacksteel1988
6 Replies

4. 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

5. 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

6. Shell Programming and Scripting

compress directories with .tar extension

hi guys.. Since am a bit new to shell scripting, can anyone help me with this problem please.. i've been struggling with it since 2 days. :( I have a directory lets say myFolder and within it I have sub directories let say myFolder1.tar, myFolder2, myFolder3, etc. I need to write a shell... (12 Replies)
Discussion started by: kanexxx
12 Replies

7. 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

8. 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

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