Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: using .NetAssembly to remove folder

Because that's not a valid PowerShell code. It looks more like C#, but it's not valid C# either.
Also with Session.RemoveFile, do not use RemotePath.EscapeFileMask.

It should be like:

(assuming you have $session variable with an instance of Session class)

Using .NET assembly to remove folder

I have an SFTP site were files are delivered in a folder, were the folder name would be the previous day date. If it's 8th October the folder would be 20201007. After that the files are downloaded, I need to remove the folder with all of its contents.

I configured the below variables in the script
$yesterday = (Get-date).AddDays(-1)
$timestamp = $yesterday.ToString("yyyyMMdd")

Then I'm trying to remove the folder using the below command

I'm being prompted /folder/$timestamp isn't recognized.