Friday, August 14, 2020

Automated script to do file transfer; WinSCP

 


winSCP script commands :

 "synchronize -nopreservetime -criteria=none remote C:\Users\Username\Desktop\Test_Folder           /dropbox/Test_Folder" ^


 "synchronize -nopreservetime -criteria=none remote <Source> <Destination>" ^


-nopreservetime -criteria=none  -> these parameters are required to ignore below error 


 2020-09-15 09:33:39.678 If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option. ("Permission denied.
. 2020-09-15 09:33:39.678 Error code: 3
. 2020-09-15 09:33:39.678 Error message from server: Permission denied")
< 2020-09-15 09:33:39.678 Script: Upload of file 'New Text Document (2).txt' was successful, but error occurred while setting the permissions and/or timestamp.
< 2020-09-15 09:33:39.678 If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.


WinSCP Commands ; Get file from server to Local machine


     "cd /dropbox/Test_Folder"^
    "lcd C:\Users\VJ\Desktop\Test_Folder\"^
    "get  -transfer=automatic New*Text*Document.txt"^
     "exit"


Put File on remote server: batch script code:

   "cd /dropbox/Test_Folder"^
    "lcd C:\Users\VJ\Desktop\Test_Folder\"^
    "put  -nopreservetime  -nopermissions -transfer=automatic New*Text*Document.txt"^
    "exit"

No comments: