Automate upload at specified time

Advertisement

thiagoconsales
Joined:
Posts:
3

Automate upload at specified time

Hello,
Starting to learn here.
I would like to know if it is possible to automatically upload a file at a certain time and what is the simplest way to do this, e.g.

Do we have any configuration in the interface?

Thanks

Reply with quote

Advertisement

thiagoconsales
Joined:
Posts:
3

Re: Automate upload at specified time

Hi Martin,

Let me explain what is the idea.
  • Download file to local directory
  • Send the downloaded file to shared folder (I don't have permission to download directly to shared folder, so in 2 steps we can...)
  • Automate this task 1 time per day.
I'm trying to use the "generate code" option to test, I try with script (bat file) as you can see below but does not working and we cannot see any error...

Bat for the first step:
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open scp://root:radex@192.168.200.1/ -hostkey=""ssh-ed25519 256 0d:9b:b3:15:79:08:96:0b:ef:e9:2b:fe:dc:5b:72:b1""" ^
    "cd /home/radex/digiprint" ^
    "lcd C:\Log" ^
    "get .counters.xml" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
Bat for the second step:
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open scp://root:radex@192.168.200.1/ -hostkey=""ssh-ed25519 256 0d:9b:b3:15:79:08:96:0b:ef:e9:2b:fe:dc:5b:72:b1""" ^
    "lcd C:\Log" ^
    "cd /home/radex/ripped-data/Log" ^
    "put -permissions=0755 .counters.xml" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
Another option is to write C# code, I don't try yet....
Based on your experience, what is the best way to make it happen?

Reply with quote

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

Re: Automate upload at specified time

"Not working" is not working as a problem description. What does it do or not do?

What does it mean that you do not have permission to download to shared folder? How can you have permissions to write to a folder, but not have permissions to download to the folder?

The second step is plain "local" file copy. If you insist on your two-step solution then the second step won't involve WinSCP at all.

Reply with quote

thiagoconsales
Joined:
Posts:
3

Re: Automate upload at specified time

Hi Martin,

I tried using the scripts above and didn't get any feedback or an error message...it looks like something happened in the backgroud but the result didn't come or I couldn't see it.....anyway the files weren't moved/copied etc ...

This remote server has a shared folder on the network that if I can send it directly there, I don't need to do it in 2 steps.

Below is image 1 and 2 when I try to download directly to the shared folder and the error that appears.

So the other way was to download to a local folder and then upload to this folder.....

Anyway if I automate the first step(download to shared folder at remote server or download to local folder.) I would like to write a C# program to email the downloaded file in this second step...or even do it all by C# using the WINSCP libraries, but I think is more complex at the beginning...

2.jpeg

1.jpeg

Reply with quote

Advertisement

You can post new topics in this forum