Automation of downloading script
I need to download three files everyday at 7:00 a.m. from a remote server, and place them on my desktop (then a sql server job picks them up and inserts into the tables).
When signed-in the remote server, there are 3 folders as follows:
<Folder 1>
<Folder 2>
<Folder 3>
In the <Folder 3>, there are two more folders and six files (three of them are log and the other three are text files). I need to download the ‘txt’ files, which are shown in red color below:
<archive folder>
<old folder>
Abc_<12345>.log
Abc_<12345>.txt
Pqr_<54215>.log
Pqr_<54215>.txt
Xyz_<64524>.log
Xyz_<64524>.txt
Please note that the number <12345> is dynamic and it changes everyday.
To test with one file, I wrote the script to automatize the downloading of the file as below:
/command "option batch abort" "option confirm off" "open sftp://<user>:<password>@<website.com >/<Folder 3>/<abc_*_txt>" "get c:\<local_filename.txt>" "exit"
Since the number part of the file name changes dynamically everyday, I have used ‘*’.
In Windows 7, I have scheduled a task to run the script automatically, and placed the above script in ‘Add arguments (optional)’ field. The ‘Program/script’ field looks as follows: ‘C:\Users\Downloads\winscp571setup.exe’
At the designated time (7:00 a.m) the Windows7 task scheduler is triggering the task. But the task “appear to” run endlessly and not completing the run even after 2 hours (the file being tested is of 6000 bytes. Other files are very huge).
Please help me with the correct script and the steps I need to follow.
When signed-in the remote server, there are 3 folders as follows:
<Folder 1>
<Folder 2>
<Folder 3>
In the <Folder 3>, there are two more folders and six files (three of them are log and the other three are text files). I need to download the ‘txt’ files, which are shown in red color below:
<archive folder>
<old folder>
Abc_<12345>.log
Abc_<12345>.txt
Pqr_<54215>.log
Pqr_<54215>.txt
Xyz_<64524>.log
Xyz_<64524>.txt
Please note that the number <12345> is dynamic and it changes everyday.
To test with one file, I wrote the script to automatize the downloading of the file as below:
/command "option batch abort" "option confirm off" "open sftp://<user>:<password>@<website.com >/<Folder 3>/<abc_*_txt>" "get c:\<local_filename.txt>" "exit"
Since the number part of the file name changes dynamically everyday, I have used ‘*’.
In Windows 7, I have scheduled a task to run the script automatically, and placed the above script in ‘Add arguments (optional)’ field. The ‘Program/script’ field looks as follows: ‘C:\Users\Downloads\winscp571setup.exe’
At the designated time (7:00 a.m) the Windows7 task scheduler is triggering the task. But the task “appear to” run endlessly and not completing the run even after 2 hours (the file being tested is of 6000 bytes. Other files are very huge).
Please help me with the correct script and the steps I need to follow.