Question: I would like to backup config files (hidden, starting with a dot) with duplicity. Only files, no directories. The following command 

```
duplicity --include '/home/foo/.*' --exclude '/home/foo/**' /home/foo sftp://myserver/backup --dry-run

```

backups everything starting with a dot, thus config directories are also included.

On the other hand 

```
duplicity --exclude '/home/foo/**' --include '/home/foo/.*' /home/foo sftp://myserver/backup --dry-run

```

produces 

> 
> Command-line include glob: /home/foo/.\*
>  only specifies that files be included. Because the default is to
>  include all files, the expression is redundant. Exiting because this
>  probably isn't what you meant.
> 
> 
> 

I have no other idea. How can I backup only files starting with a dot.

Answer: 
katonag,

try to add `--exclude '/home/foo/.*/'` or `--exclude '/home/foo/.*/**'` in the beginning eg.

```
--exclude '/home/foo/.*/' --include '/home/foo/.*' --exclude '**'

```

.

duplicity tests in/exclude by given order. so the above translates to

```
- /home/foo/.*/
+ /home/foo/.*
- **

```

where the first matches `.folder` but not the `.file`, which is matched by the second directive and the third excludes everything else.

if `/home/foo/.*/` does not work, try `/home/foo/.*/**`. that is because the duplicity matching code might not differentiate between files and folders, i have no time to test that.

good luck.. ede/duply.net

PS: there is a chapter in the duplicity man page about in/exclusion <http://duplicity.nongnu.org/duplicity.1.html#sect9>
To back up only hidden file you can use below command Here i am copying the hidden files to /tmp/location as backup

```
ls -latr | awk '$1 ~ "-rw" && $9 ~ "^." {print "cp -rvfp" " " $9 " " "/tmp/"}' | sh

```

To backup both Hidden files and directories in /tmp/ location You can use below command 

```
ls -latr | awk '$9 ~ "^." {print "cp -rvfp" " " $9 " " "/tmp/"}' | sh

```