Topic "Schedule upload of select files based on time period"

Author Message
comfortablynumb
[View user's profile]

Joined: 2013-09-05
Posts: 2
Howdy,
I'm trying to work out a script I can run as a scheduled task that will upload any files that have changed or are new in a directory and this task will run every 4 to 8 hours, not sure yet. I can't get the time mask to work.

I've gotten this far with a script, but when I put the time flag in it fails.

I've tried running this by using a command line winscp.exe /script="c:\temp\test.txt" /parameter xmllog=c:\temp\log.txt

The log isn't helping me as there's not much in the log for info.

I want to upload files every 4 hours. The source directory is on a Windows server - not sure if the slash should be \ but I think so as it works fine until I put the time in as >8H

Then the destination I put as /TEST/Log-Folder

I want all files in the folder under temp to upload. I have tried putting the path as D:\Temp\*\*.*>8H and then D:\Temp\Logs\*.*>8H

#Automatically answer all prompts negatively not to stall the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# creds saved in winscp - username & pwd are saved
open Testsite
cd
# Force binary mode transfer
option transfer binary
# Put logs in remote directory from the last 8 hours
put D:/Temp/Logs/*.*>8H /TEST/Logs-Folder
close
# Exit WinSCP
Exit
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
comfortablynumb wrote:
I've tried running this by using a command line winscp.exe /script="c:\temp\test.txt" /parameter xmllog=c:\temp\log.txt

The log isn't helping me as there's not much in the log for info.

The syntax should be: winscp.exe /script=c:\temp\test.txt /xmllog=c:\temp\log.txt
Also you probably want to use /log instead of /xmllog, if you want the log for debugging purposes.

Quote:
put D:/Temp/Logs/*.*>8H /TEST/Logs-Folder

Should be: put -filemask=>8H D:\Temp\Logs\*.* /TEST/Logs-Folder/

Anyway, whey don't use synchronize?
http://winscp.net/eng/docs/scriptcommand_synchronize
_________________
Martin Prikryl
ScriptHelpPlease

Guest


prikryl wrote:
comfortablynumb wrote:
I've tried running this by using a command line winscp.exe /script="c:\temp\test.txt" /parameter xmllog=c:\temp\log.txt

The log isn't helping me as there's not much in the log for info.

The syntax should be: winscp.exe /script=c:\temp\test.txt /xmllog=c:\temp\log.txt
Also you probably want to use /log instead of /xmllog, if you want the log for debugging purposes.

Quote:
put D:/Temp/Logs/*.*>8H /TEST/Logs-Folder

Should be: put -filemask=>8H D:\Temp\Logs\*.* /TEST/Logs-Folder/

Anyway, whey don't use synchronize?
http://winscp.net/eng/docs/scriptcommand_synchronize


I didn't want to use the synchronize because I'm uploading to an ftp site I don't control. However I can use just a task that uploads the logs that have been modified or created for that "day", I don't need to be time specific.
I have to run this as a scheduled task in Windows and then email the result code of the scheduled task as well as the log on whether the upload worked, can anyone help?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
ScriptHelpPlease wrote:
I didn't want to use the synchronize because I'm uploading to an ftp site I don't control. However I can use just a task that uploads the logs that have been modified or created for that "day", I don't need to be time specific.

How is uploading files modified/creates in a certain day not a time specific?

Anyway, continuing here:
http://winscp.net/forum/viewtopic.php?t=12887

Using relative time is definitely easier.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License