In this little article, I want to tell you about yet another trick how you could use CloudCross. Today, I looked at the search list and found one interesting request. This request looks like "copy from mail cloud to Yandex cloud". I don't know have found an author of request answer to this question or not but CloudCross has been made for resolving this and similar problems.
Ok. We consider two variants of this task. For first, copying of entire cloud to another and copying a single file. Unfortunately, CloudCross don't have a possible direct copying from cloud to cloud and we will be using a bash script for manage copying process.
Method one. Make some folder for testing. For first, we should be authorized on both clouds and have them credentials files. In our case, it should be files named .yadisk and .mailru.
If we don't have authorized access to clouds yet we should do:
ccross -a --provider mailru --login mypostbox@mail.ru --password MySUpeRPassWord
ccross -a --provider yandex
After this operation completed we will have two credentials files in our folder.
Next, we get all files from source cloud but before starting we should exclude credentials file of opposite cloud from synchronization.
echo "/.mailru*" > .exclude
Start downloading files
ccross --provider yandex --prefer remote
Next, exclude other credentials
echo "/.yadisk*" > .exclude
and does uploading files to the destination cloud
ccross --provider mailru --force upload
Well done. Level complete. ;-)
All these steps we organize like bash script
#!/bin/bash
# create testing folder
mkdir -p NEW
# jump to
pushd NEW
#auth on cloud one
ccross -a --provider mailru --login mypostbox@mail.ru --password MySUpeRPassWord
#auth on cloud two
ccross -a --provider yandex
# exclude from sync mail.ru credentials
echo "/.mailru*" > .exclude
# downloading files
ccross --provider yandex --prefer remote
# eclude from sync Yandex Disk credentials
echo "/.yadisk*" > .exclude
# uploading files
ccross --provider mailru --force upload
#remove all created during sync files and folders
rm -rf .[^.]*
rm -rf ./*
# jump from
popd
# remove testing folder
rm NEW
The second task is a copying single file. All main steps remain the same as in the previous example. Except using the .exclude file. In this case, we will be used the .include file instead.
To the .include file, we place file name such we want to copy.
echo "/VeryImportantDoc.docx" > .include
This file will be used as for downloading and for uploading. And our bash script will look like this
#!/bin/bash
# create testing folder
mkdir -p NEW
# jump to
pushd NEW
#auth on cloud one
ccross -a --provider mailru --login mypostbox@mail.ru --password MySUpeRPassWord
#auth on cloud two
ccross -a --provider yandex
# set list of downloading files
echo "/VeryImportantDoc.docx" > .include
# downloading files
ccross --provider yandex --prefer remote
# uploading files
ccross --provider mailru --force upload
#remove all created during sync files and folders
rm -rf .[^.]*
rm -rf ./*
popd
# remove testing folder
rm NEW
So, I hoping you make sure that use of the CloudCross is a simple and transparent. And that CloudCross could be helpful solution for many non-trivial problem.