Check FTP directory

Welcome Forums General PowerShell Q&A Check FTP directory

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
4 months ago.

  • Author
    Posts
  • #102902

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

      Participant
      Points: 0
      Rank: Member

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

    • #102938

      Participant
      Points: 0
      Rank: Member

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

  • #102946

    Participant
    Points: 0
    Rank: Member

    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.

The topic ‘Check FTP directory’ is closed to new replies.