Keltari Keltari You can copy cmd. What version of PowerShell are you using? And are you sure you don't have Sysinternals installed? The "du" command does not appear to be built in on any systems I have access to. Some documentation link would be helpful too. I'm on the latest fast insider channel of Windows 10 and there's absolutely no du command available — phuclv. This is also a bad answer.
This will output the combined size of all the files in the current directory. It will not however output the size of any directories in the current directory. This simply doesn't do what the op is asking. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.
Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 9. Related 9. Hot Network Questions. Question feed. Super User works best with JavaScript enabled. Accept all cookies Customize settings.
I mention in the answer that I do not know if there's a command that's faster than du.. This still would not make du any faster. A directory that takes 20 seconds to run du on would still take 20 seconds to process. Show 2 more comments. So ncdu is a powerful tool to monitor, check and analyse disk space usage on your linux system. Ankit Balyan Ankit Balyan 1 1 silver badge 3 3 bronze badges.
This looks like it may be useful, but is it faster than du? I don't understand you answer. He said he used du to check directory size, but it was too slow. He asked an advice, a faster method. And your answer: use du! Are you sure? Is it really faster than du? Ok, so there's two things: Your code does not ignore files. It also does not speed up the processing of any single directory.
What it does do is to run du over all directories at once rather than doing the du manually on each. As a consequence of this, if there are hard links , these would only be counted once by your method, but would be counted twice by the method used by the user in the question. I would have expected you to say something about this and how the question possibly was not well specified. Andy K Andy K 1 1 silver badge 3 3 bronze badges.
You can list the top 10 folders by size using this command below. I might be looking at this wrong but if I get this right I must say I have my doubts that invoking du twice is faster than invoking du once Olivier Dulac Olivier Dulac 5, 1 1 gold badge 20 20 silver badges 33 33 bronze badges. A simple command is ls xargs du -sh. BlueManCZ 1, 9 9 silver badges 26 26 bronze badges. The user said "I don't need to display the size of files, just directories", but your solution does not care about this.
Also, the main issue is the speed at which du operates, and you provide no reasoning why your code would be faster than what the user is already doing. I invite you to follow me on Twitter and Facebook.
If you have any questions, send email to me at scripter microsoft. See you tomorrow. Until then, peace. Comments are closed. Scripting Forums. PowerShell Forums. PowerShell on TechCommunity. May 25th, Microsoft Scripting Guy, Ed Wilson Doctor Scripto May 26, Microsoft Scripting Guy, Doctor Scripto May 27, NET Core. Recordset ADOR. Learn more. Windows Dir command - order subdirectories by size Ask Question. Asked 8 years, 5 months ago. Active 3 years, 4 months ago.
Viewed 56k times. Improve this question. Julian Laval. Julian Laval Julian Laval 1, 4 4 gold badges 14 14 silver badges 33 33 bronze badges. Add a comment. Active Oldest Votes. Improve this answer. Perfect one line solution! A few questions: 1 How could I get the size in bytes? The GB approximation was unnecessary, I meant to use it as an example of the file structure I was looking for.
Just something I thought was worth noting. Yes, it was cocked up. I've edited it to report bytes and if you want to remove the commas then remove the REM at the start of the line.
0コメント