# how to tar a folder with specific subfolders



## jsn (Oct 28, 2003)

Hi all.

Is there a way to tar a folder that will contain only some specific subfolders.

Here is my case:

in the folder /main/smain/ I have severa subfolders sb1, sb2, sb3

I need only to to tar subfolders sb1 and sb3 but starting from /main

is there a way to do it?
thanks
jose


----------



## btoneill (Oct 28, 2003)

```
(cd /main; tar -cvpf /tmp/foo.tar smain/sb1 smain/sb3)
```

Or, if you're already in /main


```
tar -cvpf /tmp/foo.tar smain/sb1 smain/sb3
```

Brian


----------

