Post a reply

Options
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)

Options

Topic review

martin

No you cannot have WinSCP flatten the directory structure, if that's what you ask for.
reemster0180

Works like a charm my friend! Remind me to buy a beer for you when you are in the Netherlands!

Ps. is there also a way to exclude the creation of i.e. the "ACC" folder so all the XML files (from different source folders) will directly be stored in the "\Output" folder instead within WinSCP? Otherwise I will implement a separate piece of code that will take care of that part.

Anyway.... Many many thanks!
reemster0180

Thanks for your quick response. I've attached the log as requested.
martin

Re: Filemask in place but not working

Your code looks correct. Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
reemster0180

Filemask in place but not working

I use the WinSCP (5.7.4) powershell script that will move all files in a remote folder from the SFTP server. The issue I have is partly because of the bad design of the folder structure (where I have no influence at)

I have a root folder for user 'ftp01' and that folder contains the following (sub)folders with XML files in it.

EXCLUDE FOLDERS:
/cygdrive/c/program files (x86)/icw/home/ftp01/Input/folderA/acc/

/cygdrive/c/program files (x86)/icw/home/ftp01/Input/folderA/prod/
/cygdrive/c/program files (x86)/icw/home/ftp01/Input/folderB/acc/
/cygdrive/c/program files (x86)/icw/home/ftp01/Input/folderB/prod/

ROOT (/cygdrive/c/program files (x86)/icw/home/ftp01/Input)
        |

        -->FolderA
        |             |
        |             -->test (I want these XML files)
        |             -->acc
        |             -->prod
        |
        -->FolderB
        |             |
        |             -->test (I want these XML files)
        |             -->acc
        |             -->prod

I want the script to fetch all xml files from ALL subfolders named 'test' and move them to my local directory with one script and kick it off with a windows scheduled task.

If I point the script to only one "test" folder the script works perfectly, but when I use ROOT folder as remotepath and experiment with i.e. filemasks it won't work.

I can clone the script a couple of times with a different remotepath but then I have to maintain 6 scripts and I think it can be so much better.

I use CopSSH server for windows 2008R2. I attached the script to the post.

I hope you can help me out.

Thanks in advance!

Regards,

Remy Bosma