Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review



Fantastic! That code worked like a charm! We have a saying in America, "You da' man!"

Thank you very much for your help.


Re: Help with recursive mgets

Something like following script should do:
option include */;myfile.xml
get /usr/web/config/* C:\data\MyServer\
Only problem is that this will recreate complete directory structure. Even for directories that does not have any myfile.xml in them.

Help with recursive mgets

My eyes and fingers are bleeding from all the reading and experimenting I've been doing trying to finish up my script. I am an experienced script writer, and have already written a couple with WinSCP. But I have saved the toughest for last, and I am struggling.

Here is the directory/file structure on the Unix box. I am trying to GET the files called "myfile.xml". There can be files similar, like "myfile.xml.20100228", but I don't want any files like that. ONLY myfile.xml. Here is my file/directory structure:

[no files in this directory, only subdirectories]
myfile.xml.20101113 [don't want this file]

My code results in WinSCP not finding any files in /usr/web/config/ then it quits without recursing through the subdirectories.

Here is my code:

WinSCP.exe MyServer /log=C:\MyScript.log /ini=C:\Admin\WinSCP.ini /console /command "option batch continue" "option confirm off" "get /usr/web/config/myfile.xml; /usr/web/config/*/myfile.xml C:\data\MyServer\" "close" "exit"

On the destination C: drive, if my myfile.xml is found in /usr/web/config/abc, then I would like WinSCP to CREATE that directory (if it doesn't already exist) on the C: drive under C:\data\MyServer, and pull down the myfile.xml and place it in the "abc" directory. Then continue on to the next directory "def", and so on....

Please help!