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

palPalani
  • 23
  • 2

3 Answers3

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 {} \;
Jenny D
  • 27,780
  • 21
  • 75
  • 114
2

You could use a mask for inclusion. Like a*

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

dr-evil
  • 377
  • 1
  • 5
1

tar cvf <tarfile> a*
from the directory containing all the folders will do what you want.
John
  • 9,070
  • 1
  • 29
  • 34
  • +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 '12 at 14:16