Check FTP directory

Hi,

I want to check if a directory with a certain name (YYYYMMDD) exist on an FTP server (accessed with username/password).
What’s the easiest way to do this?

Assuming you have access and can run PS on the server, Test-Path cmdlet will return True or False if the specified file/directory exists. If you don’t have physical access, you could either do a remote session in ISE or send the cmdlet in an Invoke-Command cmdlet. Lots of options.

I’ll have to check it from remote and the FTP server is not a Windows Server.

Unless you know for sure, I doubt the Server has PS installed.

There are some pre-built modules out there for managing FTP:

https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb

Powershell doesn’t have any base utilities or capabilities to manage FTP. The modules are most likely leveraging .NET to provide FTP capabilities, but looks like it may serve your needs.