Post a reply

Options
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)

Options

Topic review

martin

Re: How to execute "df/du" commands using .NET assembly(Similar to open terminal window in winscp)

If your only access to the server is using some "file transfer protocol" (FTP, SFTP, etc), then there's no better way. Except maybe with WebDAV, which has an API for providing a size of whole directory.

Other than that, the only other way is to execute a shell command that calculates the size for you. Of course, you need to have an shell access to the server for that.

See https://stackoverflow.com/q/16661982/850848.

---

In WinSCP .NET assembly, you can use the Session.ExecuteCommand method to execute such shell command:

Console.WriteLine(session.ExecuteCommand("du -h /remote/path").Output);

---

In WinSCP scripting, you can use the call scripting command to execute such shell command:

call du -h /remote/path
RookieTiro

How to execute "df/du" commands using .NET assembly(Similar to open terminal window in winscp)

Hello,

Is there any way i can execute "df/du" commands using .NET assembly(Similar to open terminal window in winscp) in windows 7 environment. So that i can export "df/du" commands results to a text file.



Thank You.