Check FTP directory

This topic contains 4 replies, has 3 voices, and was last updated by  Rob Simmers 4 weeks ago.

  • Author
    Posts
  • #102902

    Henk
    Participant

    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?

  • #102910

    Mike R.
    Participant

    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.

    • #102914

      Henk
      Participant

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

    • #102938

      Mike R.
      Participant

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

  • #102946

    Rob Simmers
    Participant

    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.

You must be logged in to reply to this topic.