Run rsync only if target directory exists?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a secondary backup drive that is usually stored offsite, but sometimes mounted. I'd like to put something in a crontab that automatically clones my backup drive to the secondary backup if it's mounted. I know that I could do something like:
if [ -d $target_dir ]; then rsync -a --delete $src_dir $target_dir; fi
but I'm wondering if there's a way to ask rsync the same thing, without resorting to a shell script? Given that it has 6.02*10^23 command line options, you'd think so...
rsync
add a comment |Â
up vote
0
down vote
favorite
I have a secondary backup drive that is usually stored offsite, but sometimes mounted. I'd like to put something in a crontab that automatically clones my backup drive to the secondary backup if it's mounted. I know that I could do something like:
if [ -d $target_dir ]; then rsync -a --delete $src_dir $target_dir; fi
but I'm wondering if there's a way to ask rsync the same thing, without resorting to a shell script? Given that it has 6.02*10^23 command line options, you'd think so...
rsync
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a secondary backup drive that is usually stored offsite, but sometimes mounted. I'd like to put something in a crontab that automatically clones my backup drive to the secondary backup if it's mounted. I know that I could do something like:
if [ -d $target_dir ]; then rsync -a --delete $src_dir $target_dir; fi
but I'm wondering if there's a way to ask rsync the same thing, without resorting to a shell script? Given that it has 6.02*10^23 command line options, you'd think so...
rsync
I have a secondary backup drive that is usually stored offsite, but sometimes mounted. I'd like to put something in a crontab that automatically clones my backup drive to the secondary backup if it's mounted. I know that I could do something like:
if [ -d $target_dir ]; then rsync -a --delete $src_dir $target_dir; fi
but I'm wondering if there's a way to ask rsync the same thing, without resorting to a shell script? Given that it has 6.02*10^23 command line options, you'd think so...
rsync
rsync
asked 2 mins ago
Scott Deerwester
20629
20629
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f479441%2frun-rsync-only-if-target-directory-exists%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