I have written a script which downloads files from server to folders based on file name. It is a very simple script and I like to use a script that checks the file name and move it to a correct folder using maybe an array instead of the way I have hard coded the names in my script. Any solution?
here is my script:
"C:\PRogram Files (x86)\winscp.com" /command "option batch on" "option confirm off" "option transfer binary" "open firstname.lastname@example.org"
if exist (/srv/sourceFolder/Home*.*) "get /srv/sourceFolder/Home*.* C:\X\Y\ALL\HME\*_%datestamp%.*"
else if exist (/srv/sourceFolder/Fact*.*) "get /srv/sourceFolder/Fact*.* C:\X\Y\ALL\BN\*_%datestamp%.*"
is it possible to create an array of file names and relevant folder names and loop through them instead of hard coding the names?how can it be done?or is there any other way of doing this?
e.g: array of file names: Home*.*, Fact*.*
and array of folders: HME, BN,....
After download I like to redirect them to the exact same folder structure on D drive. I currently use the following script:
xcopy %sourcepath% %destinationpath%
how can it be done avoiding hard coding the path?
Thanks in advance