Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in CompleteFTP by (120 points)

On a download event when I'm using simple PS command like:

remove-Item d:\root\projects\* -recurse

it works like a charm, but when trying to execute:

Get-ChildItem -Path d:\root\projects -Recurse -Force | Where-Object { -not ($_.psiscontainer) } | Remove-Item ?Force

nothing happens. The idea is to keep the folder structure under projects directory, but to delete all downloaded files. The idea is with added single process trigger to handle the entire sub folder structure but not to do a different event trigger for each project. Could you help me?

Thank you in advance!

by (161k points)
We're not Powershell experts unfortunately. As a hack have you tried running it as a process invoking Powershell and passing the script as a file to execute?
by (120 points)
Your suggestion works really nice, thank you! Still there is something like a bug or not sure how to describe it. Right now the script above deletes the files, no matter if the download was successful or if you refresh (using the f5) or log off your account, via the web browser (for example logging into the sftp by using browser). Any idea what could cause that, since only the "download file" event is checked?
by (161k points)
If you enable debug logging in the server you should see why it is being triggered. If that doesn't help, you'll need to open a support ticket and send us the zipped debug log (http://enterprisedt.com/support/open.php).
by (120 points)
Thank you very much!

Please log in or register to answer this question.