TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Fastest Way to Delete Large Folders in Windows (2015)

109 点作者 megahz将近 8 年前

26 条评论

makecheck将近 8 年前
Unless you are extraordinarily low on disk space, you should never need to &quot;wait&quot; to delete things so speed shouldn&#x27;t matter.<p>The correct method is to immediately move&#x2F;rename the target, then launch an expensive delete in the background. That frees up the location you are trying to use.<p>I used to see people set up entire workflows that started with, essentially, &quot;wait 20 minutes to finish recursively deleting the previous data&quot; instead of just &quot;move it out of the way and start immediately&quot;.
评论 #14797503 未加载
评论 #14797582 未加载
评论 #14797115 未加载
captainmuon将近 8 年前
Wasn&#x27;t at some distant time in the past deleting done by just renaming a file and changing the first character to a question mark? I think that also applied to folders: Delete a folder&#x27;s &quot;file&quot;, and all the contents are gone, recursively. Not sure how they found free blocks when creating a file though. One downside is that you never knew how much space you had left. I think at some point they changed it so that all file operations updated the &quot;free space left&quot; label in the partition. This may have been FAT around Win98, but maybe I&#x27;m misremembering or it may be some more obscure file system I&#x27;m thinking of...
评论 #14798583 未加载
评论 #14797452 未加载
评论 #14797267 未加载
评论 #14797611 未加载
评论 #14797326 未加载
jongalloway2将近 8 年前
If you&#x27;re doing this regularly, a good alternative is to install on a separate partition and symlink it. Then to delete, you just quick format the partition.<p><pre><code> echo Y | format Z: &#x2F;FS:NTFS &#x2F;X &#x2F;Q </code></pre> source: <a href="https:&#x2F;&#x2F;superuser.com&#x2F;a&#x2F;352321" rel="nofollow">https:&#x2F;&#x2F;superuser.com&#x2F;a&#x2F;352321</a><p>Also, on Windows 10 you can use Ubuntu bash and run rm -rf. I&#x27;ve read that it&#x27;s faster, but haven&#x27;t tested extensively.<p><i>Update</i>: I did a quick test with 100,000 files and the &#x27;del &#x2F;f&#x2F;s&#x2F;q foldername &gt; nul&#x27; approach was about 50% faster than &#x27;rm -rf&#x27; on my machine.
评论 #14799144 未加载
EvanAnderson将近 8 年前
He&#x27;s not handling spaces in directory names in the &quot;cd %1&quot; portion of his context-menu entry. Fortunately his &quot;fastdel.bat&quot; should prompt the user and, hopefully, they&#x27;ll catch the mistake.<p>Calling CMD.EXE from Explorer without double-quoting can have unintended consequences when ampersands and parentheses are present in the filename too. I&#x27;d hate to &quot;Fast Delete&quot; a directory named &quot;&amp; rd &#x2F;s &#x2F;q %SystemRoot% &amp;&quot; using his shell context menu entry.<p>If I was hell-bent on doing this I&#x27;d probably add it to my user registry w&#x2F; the command:<p><pre><code> reg add &quot;HKEY_CURRENT_USER\Software\Classes\Directory\shell\Fast Delete\command&quot; &#x2F;d &quot;cmd &#x2F;c rd &#x2F;s &quot;&quot;%1&quot;&quot;&quot; </code></pre> There&#x27;s still probably some fun metacharacter injection possibilities there, too, however.
bastijn将近 8 年前
Unfortunately, RMDIR as well as other windows commands suffer from the long path issue. You can turn on long path name support in win10 but that did break our regular build tooling.<p>My current way to delete any folder regardless depth of the tree is to use robocopy (robocopy D:\EmptyFolder D:\FolderToDelete &#x2F;MIR). It is actually pretty damn fast, might be faster than using RMDIR &#x2F;S &#x2F;Q.
coverband将近 8 年前
This whole page is making me claustrophobic with visions of so many things that can go wrong for trying to optimize the folder delete... Compounded by a helpful samaritan who is offering an EXE download to set up a batch file... :(
moomin将近 8 年前
The answer to this used to be Visual SourceSafe.
评论 #14797088 未加载
评论 #14797346 未加载
评论 #14799333 未加载
ramshanker将近 8 年前
At some point&#x2F;scale, quick format would be even faster.
laurent123456将近 8 年前
Reading this article reminds me how tedious it is to customise Windows. All these manual steps in system dialogs, registry and so on have to be repeated every time you want to re-install Windows.<p>I wanted to run a command as admin on startup recently and had to create a scheduled task for this, which of course will be lost the next time I reinstall. Same for services, etc.
评论 #14798774 未加载
Filligree将近 8 年前
I haven&#x27;t used Windows seriously for a while, but I&#x27;m pretty sure you can use filenames without extensions now.<p>Doesn&#x27;t that mean that the &quot;<i>.</i>&quot; pattern won&#x27;t match everything?
评论 #14797144 未加载
评论 #14798215 未加载
toyg将近 8 年前
Note that these solutions will bypass the trashcan, which is why they shouldn&#x27;t really be used willy-nilly.<p>They will also trip up in the same way Explorer does, on paths that are too long.
评论 #14797253 未加载
coin将近 8 年前
Summary - use command line tools
krylon将近 8 年前
Does anyone know how PowerShell compares to cmd.exe for this particular problem? In PowerShell, one would type:<p><pre><code> rm -Recurse -Force $path </code></pre> It has the advantage that it only takes a single command, but I am not entirely certain about the performance.
评论 #14797433 未加载
评论 #14797814 未加载
hardlianotion将近 8 年前
Similar issue deleting files through OS X Finder, also solved by going to the command line.
vorotato将近 8 年前
Okay but presumably it&#x27;s doing something with that extra time, is it valuable?
评论 #14797308 未加载
test6554将近 8 年前
Now if we could only delete files that are allegedly in use by another process.
评论 #14799023 未加载
agumonkey将近 8 年前
Never reached a case where shift + del wasn&#x27;t fast enough, interesting
评论 #14807380 未加载
damien207将近 8 年前
I will suggest to try &quot;Long Path Tool&quot; program.
tsomctl将近 8 年前
On a related note, Cygwin is also faster that Windows Explorer, although I don&#x27;t know how it compares to RMDIR.
winstonewert将近 8 年前
Is there actually a reason to do both del and rmdir instead of just rmdir? Or is the post just being superstitious?
评论 #14797089 未加载
frederik0203将近 8 年前
Try using long path tool . It worked for me. I hope it helps.
LinuXY将近 8 年前
<a href="https:&#x2F;&#x2F;windirstat.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;windirstat.net&#x2F;</a>
评论 #14797492 未加载
评论 #14797430 未加载
nvivo将近 8 年前
rimraf is extremely fast. Started using it to delete large node_modules folders and got used to it.
评论 #14798256 未加载
jscholes将近 8 年前
Legitimate question - why&#x2F;how has this made it to the front page?
评论 #14797143 未加载
评论 #14797334 未加载
评论 #14801636 未加载
coding123将近 8 年前
Install Linux?
xori将近 8 年前
Can&#x27;t you just SHIFT+DELETE?
评论 #14797073 未加载