I am looking for a way to backup/sync the contents of a CIFS share to an external USB in Ubuntu, from the CLI. I have mounted the cifs share and also mounted the external storage USB.
I have the following directory structure on the CIFS share:
$ mount -t cifs -o username='<myusername>',password='<mypassword>' //<mycifs_ip_address>/<mycifs_share_name> /mnt/myshare
$ ls /mnt/myshare
BackupFiles > > 11_28_2014 > File_Today_11_16_2013.txt > File_Yesterday_07_02_2014.txt > 07_16_2015 > File_Yesterday_04_29_2015.txt > File_Tomorrow_10_12_2015.txt > File_Yesterday_07_02_2015.txt > 12_05_2016 > File_Tomorrow_06_10_2016.txt
abc.pdf
File_Names.csv
Test.txtNote that 11_28_2014, 07_16_2015 and 12_05_2016 are directories.
I have the following directory structure on the external USB:
$ mount /dev/sha4 mnt/myusbback
$ ls /mnt/myusbback
BackupFiles > > 11_28_2014 > File_Today_11_16_2013.txt > File_Yesterday_07_02_2014.txt
def_config.sh
File_Output.dat
Testing_doc.docxAdditional information:
- I am using Ubuntu Server 16.04.1
- When mounting the CIFS share, I need to specify a username and password. The CIFS share has been set up to require these credentials when accessing it.
Problem:
I am looking for a way to:
- sense the directory structure on the CIFS share and on the external USB and create missing directories on the USB
- copy files from the CIFS share into appropriate folders on the USB, if they are missing from the USB
- Sync the
BackupFilesdirectory (including all its sub-directories) on the CIFS share and theBackupFilesdirectory on the external usb storage.
In summary, I think I need a way to sync all files (including the directory and sub-directory structure) from the CIFS share onto the external USB storage.
Questions
Is there a way to do this in Ubuntu from the CLI? Will I be prompted to specify the CIFS share username and password?
6 Reset to default