-1

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.

3 Answers 3

4

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 {} \;
2
  • Jenny D: Yes, All of them are same folder.
    – palPalani
    Dec 28, 2012 at 13:21
  • And I will add my vote to the rsync suggestion.
    – Jenny D
    Dec 28, 2012 at 14:58
2

You could use a mask for inclusion. Like a*

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

1

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

1
  • +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
    – quaie
    Dec 28, 2012 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .