Sync but not delete a certain folder,sync and delete normally the rest..

Advertisement

mariofenech
Joined:
Posts:
2
Location:
Usa

Sync but not delete a certain folder,sync and delete normally the rest..

Hi
I got a script running moving recordings from 1 raspberry pi to another..

script looks like this:
option batch abort
option confirm off
open sftp://xxx:xxx@xx.xx.xxx.xx/ -hostkey="ssh-xxxxxxxxxxxxxxxxxxxxxxxxx="
synchronize local \\192.168.0.5\hdd\Tv_Shows_Recordings /var/media/usb128/recordings
exit
This is working fine for synchronizing my files but I want to add -delete function to source..that also works fine but problem is I want to exclude a folder and it's content from being deleted but still want it to synchronize so not sure how to create a filemask to exclude this folder from being deleted after sync..I understand that a normal filemask will eventually even exclude the folder from being sync..
Thanks for any help..

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,541
Location:
Prague, Czechia

Re: Sync but not delete a certain folder,sync and delete normally the rest..

mariofenech wrote:

I want to exclude a folder and it's content from being deleted but still want it to synchronize
Do you mean that, if the local (sub)folder exists, you want to upload new and modified files to the corresponding remote (sub) folder?
But if you delete the local (sub) folder (or some files in it), you do not want the synchronization to delete the corresponding remote (sub) folder (or the files in it)?

Then you can can exclude the (sub) folder from the overall synchronization (which will use -delete). And then run another synchronize command only for that (sub) folder (without -delete).

Reply with quote

mariofenech
Joined:
Posts:
2
Location:
Usa

The local recordings folder has many subfolders in it..which I wanted to delete after sync..that was working fine..but now I need to exclude 1 of the subfolders from deleting..so if i understand well if I exclude that subfolder with a filemask it is even excluded from syncronisation..I cannot add a filemask just for delete in same script..So conclusion..I have to leave script as is just for sync and create a new one with -delete and filemask that subfolder..or add delete to existing one and filemask that subfolder altogether and create a script with sync just for it..thanks

Reply with quote E-mail

Advertisement

You can post new topics in this forum