help needed with shell script (file/folder copy/rename/deletion)/Linux drive naming


Recommended Posts

Could someone put me onto resources/provide an example for how to write a Linux shell script that copies a folder (ie. DCIM) from one USB drive drive to another, then checks and renames appropriately on the second drive (if 'DCIM1' exists, rename 'DCIM' to 'DCIM2'), then erases the contents of the DCIM folder on the original drive? With progress meter would be nice also.

Also, is there a way to assign a particular USB drive as 'sdb5' permanently?

Thanks in advance.

Link to comment
Share on other sites

so you can mount drves by using th UUID of the drive

learn about that here

http://www.cyberciti.biz/faq/linux-finding-using-uuids-to-update-fstab/

 

so if you have the drives mount to the same place all the time this is nice and easy

to copy the files

rsync -av --progress --ignore-existing /home/placewherefilesare/* /home/placetocopyto/

so --progress gives you a progress of whats happening

--ignore-existing means it does an incremental backup so will ignroe files already existing that hae not changed

once you are done to delete the old folder

rm -rf /home/placewherefilesare

 

does this point you in the right direction?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.