Topic "Cannot parse folder content when .DS_Store hidden file is present"

Author Message
elmuz

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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

Guest


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
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License