Reputation: 45
I have a folder (Source) that contains subfolders and XML files:
Source\
Folder1\
Folder2\
Folder1.xml
Folder2.xml
I need to transfer these subfolders and files through SFTP using WinSCP but my constraint is that I need to transfer the subfolders first and only at the end the remaining files.
I can use the put
command, but it seems that if I use wildcard it copies everything.
I.e:
put \\Sharepath\Source\*
Using the Windows scripting it works fine, but it seems that I can't do the same thing using put
command
I.e:
'Copy only folders
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder \\\SharePath\Source\*, \\\SharePath\Destination, True
'Copy only files
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFiles \\\SharePath\Source\*.xml, \\\SharePath\Destination\, True
Upvotes: 1
Views: 1020
Reputation: 202197
Use WinSCP put
command twice:
first to upload only the subfolders by excluding the *.xml
files using a filemask:
put \\Sharepath\Source\* -filemask=|*.xml
See
https://winscp.net/eng/docs/file_mask
https://winscp.net/eng/docs/scriptcommand_put#filemask
second, to upload the `.xml files:
put \\Sharepath\Source\*.xml
Upvotes: 1