Pass a list of directories to rsync
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a text file list_of_dirs_to_copy
with 120 paths:
data/A/backups/2018_02_12
data/B/backups/2/files
data/B/old_files/2015_12
data/C/my_datafiles/800/dat
data/F/backups & old files (second backups)
...
IMPORTANT NOTE: line breaks are LF
in the file above and there are special characters such as &
and (
in directory names.
data
is located in /mnt/storage3/workfiles/backups
. So I do cd /mnt/storage3/workfiles/backups
so that paths in my list_of_dirs_to_copy
become relevant.
Now I want to copy all of the directories listed in my text file (with all of their hidden files and sub-directories) to another hard drive using the following command.
rsync -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats $list_of_directories /drives/f/data_backups/
How can I pass the list of directories to rsync
without breaking it (i.e. receiving Argument list too long
)? Would it be possible to send each line of the text to rsync
one by one? Would that make sense?
rsync backup
add a comment |Â
up vote
1
down vote
favorite
I have a text file list_of_dirs_to_copy
with 120 paths:
data/A/backups/2018_02_12
data/B/backups/2/files
data/B/old_files/2015_12
data/C/my_datafiles/800/dat
data/F/backups & old files (second backups)
...
IMPORTANT NOTE: line breaks are LF
in the file above and there are special characters such as &
and (
in directory names.
data
is located in /mnt/storage3/workfiles/backups
. So I do cd /mnt/storage3/workfiles/backups
so that paths in my list_of_dirs_to_copy
become relevant.
Now I want to copy all of the directories listed in my text file (with all of their hidden files and sub-directories) to another hard drive using the following command.
rsync -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats $list_of_directories /drives/f/data_backups/
How can I pass the list of directories to rsync
without breaking it (i.e. receiving Argument list too long
)? Would it be possible to send each line of the text to rsync
one by one? Would that make sense?
rsync backup
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a text file list_of_dirs_to_copy
with 120 paths:
data/A/backups/2018_02_12
data/B/backups/2/files
data/B/old_files/2015_12
data/C/my_datafiles/800/dat
data/F/backups & old files (second backups)
...
IMPORTANT NOTE: line breaks are LF
in the file above and there are special characters such as &
and (
in directory names.
data
is located in /mnt/storage3/workfiles/backups
. So I do cd /mnt/storage3/workfiles/backups
so that paths in my list_of_dirs_to_copy
become relevant.
Now I want to copy all of the directories listed in my text file (with all of their hidden files and sub-directories) to another hard drive using the following command.
rsync -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats $list_of_directories /drives/f/data_backups/
How can I pass the list of directories to rsync
without breaking it (i.e. receiving Argument list too long
)? Would it be possible to send each line of the text to rsync
one by one? Would that make sense?
rsync backup
I have a text file list_of_dirs_to_copy
with 120 paths:
data/A/backups/2018_02_12
data/B/backups/2/files
data/B/old_files/2015_12
data/C/my_datafiles/800/dat
data/F/backups & old files (second backups)
...
IMPORTANT NOTE: line breaks are LF
in the file above and there are special characters such as &
and (
in directory names.
data
is located in /mnt/storage3/workfiles/backups
. So I do cd /mnt/storage3/workfiles/backups
so that paths in my list_of_dirs_to_copy
become relevant.
Now I want to copy all of the directories listed in my text file (with all of their hidden files and sub-directories) to another hard drive using the following command.
rsync -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats $list_of_directories /drives/f/data_backups/
How can I pass the list of directories to rsync
without breaking it (i.e. receiving Argument list too long
)? Would it be possible to send each line of the text to rsync
one by one? Would that make sense?
rsync backup
edited Jul 11 at 12:31
asked Jul 11 at 12:28
benett
354
354
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
rsync -av ...options... --files-from=list_of_dirs_to_copy
/mnt/storage3/workfiles/backups/
/drives/f/data_backups
The paths in list_of_dirs_to_copy
would be interpreted as being relative to the source directory. With the given list, this would create data
as a subdirectory under /drives/f/data_backups
.
This is most probably caused by myrsync
(I am usingMobaXterm
) which leads me to an error when I use the--files-from
tag. So I instead opted for:while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.
â benett
Jul 11 at 13:00
The error I am receiving is:Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
1
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
rsync -av ...options... --files-from=list_of_dirs_to_copy
/mnt/storage3/workfiles/backups/
/drives/f/data_backups
The paths in list_of_dirs_to_copy
would be interpreted as being relative to the source directory. With the given list, this would create data
as a subdirectory under /drives/f/data_backups
.
This is most probably caused by myrsync
(I am usingMobaXterm
) which leads me to an error when I use the--files-from
tag. So I instead opted for:while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.
â benett
Jul 11 at 13:00
The error I am receiving is:Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
1
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
add a comment |Â
up vote
2
down vote
rsync -av ...options... --files-from=list_of_dirs_to_copy
/mnt/storage3/workfiles/backups/
/drives/f/data_backups
The paths in list_of_dirs_to_copy
would be interpreted as being relative to the source directory. With the given list, this would create data
as a subdirectory under /drives/f/data_backups
.
This is most probably caused by myrsync
(I am usingMobaXterm
) which leads me to an error when I use the--files-from
tag. So I instead opted for:while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.
â benett
Jul 11 at 13:00
The error I am receiving is:Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
1
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
add a comment |Â
up vote
2
down vote
up vote
2
down vote
rsync -av ...options... --files-from=list_of_dirs_to_copy
/mnt/storage3/workfiles/backups/
/drives/f/data_backups
The paths in list_of_dirs_to_copy
would be interpreted as being relative to the source directory. With the given list, this would create data
as a subdirectory under /drives/f/data_backups
.
rsync -av ...options... --files-from=list_of_dirs_to_copy
/mnt/storage3/workfiles/backups/
/drives/f/data_backups
The paths in list_of_dirs_to_copy
would be interpreted as being relative to the source directory. With the given list, this would create data
as a subdirectory under /drives/f/data_backups
.
answered Jul 11 at 12:35
Kusalananda
101k13199312
101k13199312
This is most probably caused by myrsync
(I am usingMobaXterm
) which leads me to an error when I use the--files-from
tag. So I instead opted for:while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.
â benett
Jul 11 at 13:00
The error I am receiving is:Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
1
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
add a comment |Â
This is most probably caused by myrsync
(I am usingMobaXterm
) which leads me to an error when I use the--files-from
tag. So I instead opted for:while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.
â benett
Jul 11 at 13:00
The error I am receiving is:Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
1
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
This is most probably caused by my
rsync
(I am using MobaXterm
) which leads me to an error when I use the --files-from
tag. So I instead opted for: while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.â benett
Jul 11 at 13:00
This is most probably caused by my
rsync
(I am using MobaXterm
) which leads me to an error when I use the --files-from
tag. So I instead opted for: while read -r COPYPATHS; do rsync -R -rvh --append-verify --chmod=ugo=rwX --no-o --no-g --no-perms --progress --stats "$COPYPATHS" /drives/f/data_backups; done < /home/files/list_of_dirs_to_copy.txt
. This no longer produces an error.â benett
Jul 11 at 13:00
The error I am receiving is:
Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
The error I am receiving is:
Use "rsync --daemon --help" to see the daemon-mode command-line options. Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation. See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/options.c(1653) [client=3.0.9]
â benett
Jul 11 at 13:00
1
1
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
@benett Huh? I hope you replaced my "...options..." placeholder with your actual options.
â Kusalananda
Jul 11 at 13:38
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454687%2fpass-a-list-of-directories-to-rsync%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password