Backup directories with space in directory name

Jack McGee jack at greendesk.net
Sun Jan 1 18:45:49 UTC 2017


On 12/31/2016 08:57 PM, Karl Auer wrote:
> On Sat, 2016-12-31 at 10:14 -0600, Jack McGee wrote:
>> Thanks all.  It succesfully backed up the My Documents folder, but
>> of course, now I want to have it also backup
>>
>> /usr/local, /var /etc /opt /home
>> [...]
>> How should I tweak script further to allow that?
> The simplest approach is to manually build the tar command:
>
>     dir1="/this/is/the/first"
>     dir2="/this/is/the/second"
>     dir3="/this/is/the/third"
>     
>     [...]
>
>     tar cfv "$dest/$archive_file" "dir1" "dir2" "dir3"

This works just fine for me,  thanks much.
The script I was using can be found here:
https://help.ubuntu.com/lts/serverguide/backups-shellscripts-rotation.html




More information about the ubuntu-users mailing list