Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a long list of folders. i want tar only folder which starts with "a". How can i do that?

Actually, I am having photo gallery website, which has 1000s of folders. I wish to move another server using wget option. Total size of the gallery is around 25GB. Moving 25GB will take more time, for that i am looking for the solution.

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Are all folders within the same top folder? If so, the answer is simple:

tar cf /path/to/outfile.tar /path/to/folders/a*

If the files are not all in the same folder, you can do a find to get them:

find /path/to/folders/ -type d -name a\* -exec tar rf /path/to/outfile.tar {} \;
share|improve this answer
    
Jenny D: Yes, All of them are same folder. –  palPalani Dec 28 '12 at 13:21
    
And I will add my vote to the rsync suggestion. –  Jenny D Dec 28 '12 at 14:58

You could use a mask for inclusion. Like a*

To move\sync files and folders take a look over rsync

share|improve this answer

tar cvf <tarfile> a*
from the directory containing all the folders will do what you want.

share|improve this answer
    
+1 for rsync, since if the connection fails, it will resume the transfer and copy only remaining files; if you don't have access to setup a rsync daemon at the other end, just use rsync over ssh –  petre Dec 28 '12 at 14:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.