Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

Sorry, but you just repeated what your wrote before. What's the problem with the .DS_Store files? You exclude them by your file mask, right? So their presence should not matter. I still have no idea, what you mean by "cannot parse the content anymore". What content?
elmuz

The Powershell script is trying to keep a local folder synched with a remote one, which is daily updated by operators.
This is the "hot" part

# Transfer options
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "* . m p 3>20K" // without spaces
# Synchronize files
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Local, $syncPath, $remotePath, $True, $transferOptions)

Since some of them are probably working from Mac it may happen that they copy rubbish files apart from needed m p 3 files.
I was able to see two kind of rubbish files:
1) Ghost copies of 1-2 kB of original m p 3, which I am able to ignore by masking for size > 20kB. However this kind of file is not blocking the synch process.
2) .DS_Store files, that should be a folder-related property file. If this file is inside the folder the script cannot parse the content anymore, blocking the synch process.
martin

Re: Cannot parse folder content when .DS_Store hidden file is present

elmuz wrote:

- When someone copies in remote path also .DS_Store file, probably from Mac, my Powershell script cannot parse the content anymore.

Can you elaborate? What PowerShell script? What content?
elmuz

Cannot parse folder content when .DS_Store hidden file is present

I couldn't find any similar topic so I am writing it here.

SCENARIO
- Windows Server 2012
- Powershell scripting
- WinSCPnet.dll 5.8.1.0 (version 1.3.1.6144)
- I am checking a remote FTP for new audio files and I'm mirroring from remote to a local path.
- When someone copies in remote path also .DS_Store file, probably from Mac, my Powershell script cannot parse the content anymore.

Here's part of my script:

[....]
try
{
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Ftp
$sessionOptions.HostName = $ftpHost
$sessionOptions.UserName = $ftpUser
$sessionOptions.Password = $ftpPass
$sessionOptions.FtpMode = "Active"

$session = New-Object WinSCP.Session

try
{
#Per prima cosa sincronizzo l'FTP con una cartalla locale
# Connect
$session.Open($sessionOptions)

# Transfer options
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "* . m p 3>20K" // without spaces
# Synchronize files
$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Local, $syncPath, $remotePath, $True, $transferOptions)

# Throw on any error
$synchronizationResult.Check()

# Log synchronization results
If ($synchronizationResult.IsSuccess)
[....]

Any idea?
Thank you