Search code examples
winscp

WinSCP - ignore single directory during sync


I have a directory on a server that needs to synchronize its contents to a client. It is set to delete files on the client that have also been deleted from the directory that is to be synced from the server.

I want to ignore a specific directory, so it does not delete its contents on the client.

The following script (located on the client) currently deletes the contents located in /files/synced/oss/test/ but I want that directory to keep its contents on the client.

option exclude "Thumbs.db; /files/synced/oss/test/"
synchronize local -delete "D:\files" "/files/synced"

Solution

  • If I understand your question correctly, you do not want to exclude a remote folder /files/synced/oss/test/.

    You want to exclude a local folder D:\files\oss\test\.

    Also note that the option exclude has been deprecated, use -filemask switch instead.

    synchronize local -delete -filemask="| Thumbs.db; D:\files\oss\test\" "D:\files" "/files/synced"