1

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.

0

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

  • Thanks, this indeed solves the task. I have read the man page about exclusion, but it seems I have over complicated. As I see the problem with my try was that I have excluded everything in the beginning and tried to add only files. And would like to say big thank also for duply. – katonag Jan 25 '18 at 19:39
-1

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
  • This is some sort of workaround, but it is definitely not what the question is about. It breaks the easy restore functionality and it is not really good in case of big files. The desired behavior should be possible with duplicity itself, simply I do not know how to achieve it. If not, then this workaround can be a solution. – katonag Jan 19 '18 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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