PowerShell checking a file on an FTP server

Good afternoon to all

Please tell. Me how to connect to the FTP server via Powershell, check for the presence of a file, for example: test.txt and if there is one, delete it.

Thank you very much

Kirill,
Welcome to the forum. :wave:t3:

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

AFAIK there is nothing built in in PowerShell to access FTP servers. But you don’t have to re-invent the wheel again. Please use your preferred internet search enginge to look for examples of code such a task. Or you may search the
www.PowerShellGallery.com
for an according module.

2 Likes

This link looks promising. It even includes a function to delete a file (Remove-FTPFile)

A quick google search there’s some hits on modules/wrappers at least one person has created: EvotecIT/Transferetto: Small PowerShell module with FTPS/SFTP functionality (github.com). Article here: Easy way to connect to FTPS and SFTP using PowerShell - Evotec. Look like the module also supports removing files.