PUT upload with Time Constraint

Advertisement

zoomzoomvince
Joined:
Posts:
1
Location:
Derby

PUT upload with Time Constraint

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.


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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: PUT upload with Time Constraint

- 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

Reply with quote

Advertisement

You can post new topics in this forum