Topic "PUT upload with Time Constraint"

Author Message
zoomzoomvince
[View user's profile]

Joined: 2016-11-16
Posts: 1
Location: Derby
I have got a job which builds a script (by echoing out the commands to a text file) and which is then executed by WinSCP to upload some files. I am trying to tell it to upload CSV files created within e.g. 60 minutes. The trouble is that it is ignoring the mask and uploading all the files.


Code:
echo open %oracle_usr%:%oracle_pwd%@%oracle_svr% -hostkey=%oracle_key% > SSH_SCRIPT3.TXT
echo lcd %EXTRACT_DIR% >> SSH_SCRIPT3.TXT
echo cd %oracle_dir% >> SSH_SCRIPT3.TXT
echo put %TRANSACTION_EXTRACT_DIR%\FINANCE*.csv*^\>60N%DD%%MM%%YYYY%^ >> DPA_SSH_SCRIPT3.TXT


60N sets it to only get files created within the last 60 minutes and %DD%%MM%%YYYY% is the timestamp format (UK).
Because I am piping it out to a file I have escaped it with the ^ character.
~Even if I drop %DD%%MM%%YYYY% and just have ^>10N^ it still uploads all the files.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26730
Location: Prague, Czechia
- But you have to escape the ^. What is the \ good for there?
- I also do not understand, why are you adding the %DD%%MM%%YYYY% there.
- Why is a script name different? SSH_SCRIPT3.TXT vs. DPA_SSH_SCRIPT3.TXT

This should be working:
echo put %TRANSACTION_EXTRACT_DIR%\FINANCE*.csv*^>60N >> DPA_SSH_SCRIPT3.TXT

Though this is more safe and you do not need any escaping:
echo put "%TRANSACTION_EXTRACT_DIR%\FINANCE*.csv*>60N" >> DPA_SSH_SCRIPT3.TXT
Advertisements

You can post new topics in this forum

Search

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