How To Recursively Delete Files And Directories Using Java如何遞歸刪除的文件和目錄使用Java
How can you recursively delete files and directories in windows?你如何能遞歸刪除的文件和目錄在Windows呢? You can select them in explorer (in windows) and delete it, right?您可以選擇他們在Explorer (在Windows ) ,並刪除它,對不對?
The problem with the explorer approach is that if one or more files and / or directories cannot be deleted then the whole process fails.問題與資源管理的做法是,如果一個或多個文件和/或目錄不能被刪除,然後在整個過程中失敗。 Try cleaning your Local Settings\temp directory to see an example.嘗試清洗您的本地設置\ Temp目錄中看到一個例子。 Most likely it will fail in windows explorer.最有可能會失敗,在Windows檔案總管。
Also I have seen it fail when large number of files are selected.此外,我所看到的,它失敗時,大量的文件,都被選中。 It is slow and not usable from command line.它是緩慢的而不是從實用的命令行。
(In Unix/linux the problem is much simpler - rm -rf * ) (在UNIX / Linux的問題是簡單得多-室-射頻* )
However for the moment let’s see how we can simplify this on windows using a bit of java.不過,目前讓我們看看我們如何能夠簡化這個對Windows中使用了一點Java的。 I present with with a superfast method to delete multiple files and directories from command line recursively.我提交同一個超方法刪除多個文件和目錄由命令行遞歸。
Download下載 Delete.class delete.class
Usage:用法:
java Delete [list of files and / or directories] Java的刪除[清單文件和/或目錄]
No warranties (express or implied) are provided.任何形式的保證(明示或暗示)提供。 Use at your own risk.使用您自己承擔風險。 All deletion using this utility is final .刪除所有使用此實用工具是最終的決定 。 It cannot be recovered from Recycle Bin (on windows).它無法恢復從回收站(在Windows ) 。
Filed under提起下 Headline News頭條新聞 , , How To如何 , , Java Software Java軟件 , , Linux Linux的 , , Microsoft微軟 , , Tech Note技術說明 , , Windows在Windows | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article電子郵件此文章
You may also like to read您也可以想讀 |




