Hi,
How can I check if any file exist on a remote FTP-server with powershell and so the return value is False or True?
I need that value since I use Invoke-Command in an other script to call for this script and if it isn't possible I can change the script a bit so it write to a logfile and I'll have another script checking that log file.
See the "# Check File" line
This returns the value False even if there is a file on the remote location:
# Connect
$session.Open($sessionOptions)
# Remote Path
$remotePath = "/transfer/ut/*"
# Check File
$Exsist = $session.FileExists($remotePath)
# Disconnect, clean up
$session.Dispose()
And this return me with the filename/filenames looking like this:
Files
-----
{.., file.txt, .}
or
Files
-----
{.., ., file.txt}
or
Files
-----
{.., .}
# Connect
$session.Open($sessionOptions)
# Remote Path
$remotePath = "/transfer/ut/"
# Check File
$Exsist = $session.ListDirectory($remotePath)
# Disconnect, clean up
$session.Dispose()
Thank you!