Why does it take so long to calculate directory size ?

Advertisement

oliverfr
Joined:
Posts:
44

Why does it take so long to calculate directory size ?

Hello,

On a remote folder that supposedly contains around 15 GB of data, I saw winscp only reaching 50% calculation after 4 minutes had passed.

I don't want to sound too cocky (to the contrary, I'll assume it's simply there must be many factors that I didn't even imagine), but isn't there a way to make it faster ?

FTP commands support advanced listing of a directory contents (LIST, and of course SIZE), which might perhaps be exploited to do a calculation ?

Much better (so : at least, do that for SFTP sessions ?) SFTP commands allow the even more useful "du -lh" command.

Well, this is half a question, half a suggestion, there might be a relatively easy field for improvement, and sorry if it was so complicated this is impossible to implement but I had no idea ;)

Reply with quote

Advertisement

oliverfr
Joined:
Posts:
44

A thought just struck me. I have somehow already lived that.
Many years ago, I did the same kind of suggestion in the Filezilla forum (that was before I found that filezilla was storing passwords in a plain text easy to steal file), looking obvious, but that was rejected because it was more complicated that it sounded.

I asked why it took so LONG to delete a directory with hundreds of subdirectories and thousands of files during a SFTP connexion, while a simple "rm -rf *" would automatically do the job in microseconds. And I was answered that Filezilla was an FTP program, so it was sort of cheating to run shell commands instead of FTP commands, even when it was SFTP. Even today, I have yet to understand the reasoning.

But if it's the same conclusion with WinSCP regarding my calculation of directory total size, well, okay.

Anyway, the main point of me answering in my own thread : MERRY HOLIDAYS EVERYONE ! And thank you for the great software :)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,440
Location:
Prague, Czechia

Re: Why does it take so long to calculate directory size ?

Thanks for your suggestion.

For FTP: WinSCP IS using LIST command (or modern MLSD) for this purpose.
For SFTP: You CANNOT execute shell commands in SFTP session. WinSCP only seemingly allows you to do that in GUI by opening separate shell session:
https://winscp.net/eng/docs/shell_session
And mainly it works only for *nix servers, so it's not platform-independent.

On a remote folder that supposedly contains around 15 GB of data, I saw winscp only reaching 50% calculation after 4 minutes had passed.
It can take long if there are many subdirectories. Was it the case?

Reply with quote

Advertisement

You can post new topics in this forum