Sync Remote Remote directory with a local Directory

Advertisement

ntoreax
Joined:
Posts:
13

Sync Remote Remote directory with a local Directory

Good morning Everyone
I am facing an issue where a wrote this script to sync Remote directory with Local Directory and every time the script runs I get
Nothing to synchronize.
C:\Users\axel.ntore\Documents\Ntore>"C:\Program Files (x86)\WinSCP\winscp.com"  /scri
pt=C:\Users\axel.ntore\Documents\Ntore\syncfilescriptwinscp.txt
batch           abort
confirm         off
Searching for host...
Connecting to host...
Authenticating...
Using username "user001".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] user001@172.28.66.19
Using configured synchronization options different from factory defaults.
Comparing...
Local 'C:\Users\axel.ntore\Documents\031722\031722' => Remote '/'
Nothing to synchronize.

C:\Users\axel.ntore\Documents\Ntore>pause
Press any key to continue . . .
script details
option batch abort
option confirm off
open sftp://user001@172.28.66.19 -hostkey="ssh-ed25519 255 AwCsIqqS6p8caWKAOYNtQwkU2ae2xtG5wnIBHU3gOKg="
synchronize remote C:\Users\axel.ntore\Documents\031722\031722 /
exit
Bat file that calls the script
"C:\Program Files (x86)\WinSCP\winscp.com/script=C:\Users\axel.ntore\Documents\Ntore\syncfilescriptwinscp.txt
 
pause
Please advise what could be the cause and how I can approach this.
If any details missing to understand the file transfer automation let me know.

Axel N

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,209
Location:
Prague, Czechia

Re: Sync Remote Remote directory with a local Directory

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

ntoreax
Joined:
Posts:
13

Sync Remote Remote directory with a local Directory

Good Day,
apologies for the late reply.
Attached is the requested logs. The scripts remains the same but I changed the running machine in case your wondering the difference in the keys :)
Outcome still the same, nothing to sync.
If any clarification needed am here and thanks for your support.
  • logfile.zip (459 KB, Private file)
Description: winscp script logs

Reply with quote

martin
Site Admin
martin avatar

Re: Sync Remote Remote directory with a local Directory

Please, give us a name of one specific file that you expected to get synchronized and explain why.

Reply with quote

ntoreax
Joined:
Posts:
13

Re: Sync Remote Remote directory with a local Directory

Good Day martin

the file name on local machine/server lexaccs_20220313194756514.txt, lexaccs_20220313202756510.txt,... are generated after 1 min and I want those files to be copied to Remote location which is a Linux server / Ubuntu server. And using WinSCP is the best option.
The current script shows the files to be sync, but it does not copy them to remote.
But when I do the same from the GUI (WinSCP) it keeps both source and destination up to date.

And the reason why I wanted to use the script is that on the source (local server) I have 2 different directories that receives such files every one min to be sent to that remote server.
Also in the GUI sometimes hang ... that why the script is the best option for me.

Hope I answered your question. If not am here to clarify and thanks for your time.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,209
Location:
Prague, Czechia

Re: Sync Remote Remote directory with a local Directory

The file 031722lexaccs_20220313194756514.txt already exists in the remote directory and it is newer than the local copy:
. 2022-04-05 15:54:39.145 Remote file '/lexaccs_20220313194756514.txt' [2022-03-30T18:02:23.000Z] [209] is modified comparing to local file 'C:\Users\axel.ntore\Documents\031722\031722lexaccs_20220313194756514.txt' [2022-03-13T17:46:11.017Z] [209]
Though there's something wrong with the paths. Isn't there missing backslash between 031722 and lexaccs_20220313194756514.txt in C:\Users\axel.ntore\Documents\031722\031722lexaccs_20220313194756514.txt. What is even the C:\Users\axel.ntore\Documents\031722(\031722)? Where does it come from? I see that you are synchronizing D:\home\rndps\MTN\user800\BULKUPLOAD. Is that a link to the C:\Users\axel.ntore\Documents\031722?

Can you post a GUI log file that shows that GUI synchronizes 031722lexaccs_20220313194756514.txt right after the script did not?

Reply with quote

ntoreax
Joined:
Posts:
13

Re: Sync Remote Remote directory with a local Directory

Afternoon
as requested here is the newly Captured logs
  • logfile.zip (673.16 KB, Private file)
Description: sharing new log file

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,209
Location:
Prague, Czechia

Re: Sync Remote Remote directory with a local Directory

I do not see any lexaccs_20220313194756514.txt (nor 031722lexaccs_20220313194756514.txt) in the new log.

Can you post logs from both script and GUI that show, how script does not synchronize a specific file (name it) that the GUI does, when executed right after the script? Can you also answer my path questions from my previous post?

Reply with quote

ntoreax
Joined:
Posts:
13

Sync Remote Remote directory with a local Directory

Noted , if i understand you well i capture a screenshot showing the files in source directory that are not being picked and also attach logs showing the results
let me do that hope i did not miss any steps of your request

also to clarify on the file name (lexaccs_20220313194756514.txt ...) in the new log.
am running the script on both my test machine and prod to see if its not a box issue

let me share logs from my prod box since its where am running it but file name will be different you will see it in the logs
let me capture all the information and thanks for your support

Reply with quote

Advertisement

ntoreax
Joined:
Posts:
13

Sync Remote Remote directory with a local Directory

As Requested
attach are the logs and the screenshot
  • screenshotSync.png (20 KB, Private file)
Description: SynccmdScreenshot
  • logfile.zip (2.26 MB, Private file)
Description: WINSCPLGOS

Reply with quote

ntoreax
Joined:
Posts:
13

Sync Remote Remote directory with a local Directory

Thanks for the quick feedback
all the files with new were not picked, I attach a new set of logs with more details
  • when I run the script it check but does not pick the files (3 files highlighted)
  • when I log to WinSCP and do keep remote sync the files are being picked not sure why on the script it shows nothing to sync
  • logfile.zip (816.48 KB, Private file)
Description: logswhenirunthescript
  • scriptResultCmd.png (34.69 KB, Private file)
Description: result of the script that is suppose to pick the files and move them to the server
  • beforescriptrun.png (45.13 KB, Private file)
Description: before script run

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,209
Location:
Prague, Czechia

Re: Sync Remote Remote directory with a local Directory

You are synchronizing "existing files only":
. 2022-04-28 13:05:54.517 Collecting synchronization list for local directory 'D:\home\rndps\MTN\user800\BULKUPLOAD' and remote directory '/', mode = Remote, params = 0x6 (NoConfirmation, ExistingOnly), file mask = ''
I assume that unintentionally. Your script is not isolated from your GUI configuration, what is against recommendations:
https://winscp.net/eng/docs/scripting#configuration

The script even warns you about that:
< 2022-04-28 13:05:54.517 Script: Using configured synchronization options different from factory defaults.
Adding /ini=nul to WinSCP command line should fix your problem.

Reply with quote

Advertisement

ntoreax

Sync Remote Remote directory with a local Directory

Thank you very much the issue is fix.
Indeed the problem was with /ini=nul part the isolation was the key.

Reply with quote

Advertisement

You can post new topics in this forum