Deleting all empty folders using WinSCP

Advertisement

Pretty
Joined:
Posts:
1

Deleting all empty folders using WinSCP

Hello,

I'm using WinSCP through an SSIS task.

I'm want to delete all the empty directories in the sftp server, but it doesn't work.

My code :

winscp.StandardInput.WriteLine("open Sftp://" + UserFilesServer + "@" + FilesServer + ":" + WinSCPPort + " -privatekey=" + KeyFilesServer + " -passphrase=" + WinSCPPass);
winscp.StandardInput.WriteLine(" cd " + PathFilesServer);
[...]
winscp.StandardInput.WriteLine(" cd ../" + PathFilesServerEnvoi);
winscp.StandardInput.WriteLine("rmdir *");

Everything works, except the last line "rmdir *" that doesn't have any effect.

I tried to use "rm *<1M" to delete everything that is less than 1MB but it deleted everything in the directory, even if it weights more than 1MB.

Can someone help me with this problem ?

Thank you in advance, best regards.

Pretty.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum