Options

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

## Re: Sync down specified folder (under subdirs)

Andieboy wrote:

I thought, there is some wildcard parametering in path as well, something like:
> synchronize /dir1/dir2/*/getthese*/*.zip

You can do this, but it will recreate a remote directory structure locally. What I understand that you do not want to.
Andieboy

## Re: Sync down specified folder (under subdirs)

Hi Martin,

thank you for the answer, I was afraid you left the forum and I won't get any answer :)

Okay, I'll try that you mentioned.
I thought, there is some wildcard parametering in path as well, something like:
> synchronize /dir1/dir2/*/getthese*/*.zip

/dir1/dir2/ abc /getthese1/alpha.zip
/dir1/dir2/ abc /getthese2/beta.zip
/dir1/dir2/ cde /getthese8/zeta.zip
/dir1/dir2/ xyz /gettheseYX/omega.zip

and so on..

That would be something logical for me, btw, what is the reason to NOT working that way? (I don't want to change WinSCP, I just want to understand :) )

Thanx again!
martin

## Re: Sync down specified folder (under subdirs)

You cannot do this with simple WinSCP scripting.
But it's easy with WinSCP .NET assembly and PowerShell
https://winscp.net/eng/docs/library_powershell

And modify it to get something like:

`\$date = (Get-Date -Format "yyyyMMdd") \$subdirInfos =    \$session.EnumerateRemoteFiles(        "/reportfiles/XYreports/\$date", "AAA123*",        [WinSCP.EnumerationOptions]::MatchDirectories) foreach (\$subdirInfo in \$subdirInfos){    Write-Host "Downloading from \$(\$subdirInfo.FullName)"    \$session.GetFiles(        \$subdirInfo.FullName + "/*.zip", "C:\transfer\*").Check()}`
Andieboy

## Sync down specified folder (under subdirs)

Dear All,

I'm new on this forum, altought I'm using winSCP for years. But now, I've faced a problem, I can't solve for days.
I have the following directory structure on a SFTP server:

/reportfiles/XYreports/yyyymmdd/termid_datetimestamp/

Which means, that under XYreports (last fix dirname), there are date-named directories, whereunder there are hundreds of terminalID driven dirnames. All those terminalID subdirectories contains only 1 ZIP file, whise are important for us. But only for specified terminalIDs!

So for exact example:

/reportfiles/XYreports/20171013/AAA123_20171013_091400/
/reportfiles/XYreports/20171013/AAA124_20171013_091500/
/reportfiles/XYreports/20171013/AAA125_20171013_091600/
/reportfiles/XYreports/20171013/AAA126_20171013_091700/
/reportfiles/XYreports/20171013/BBB567_20171013_091800/
...
/reportfiles/XYreports/20171014/AAA123_20171014_072400/
/reportfiles/XYreports/20171014/AAA124_20171014_072400/
...
/reportfiles/XYreports/20171015/AAA123_20171015_102200/
...

and so on. there are only 1 zip under those final subdirectories.

I'm interested on EVERY DAY, only on AAA123 -named terminal's zip file. (and later the BBB556 for example). All others I don't want even download.

My best effort was:

```cd /reportfiles/XYreports/20171015/
```cd /reportfiles/XYreports/