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