2015-12-15 79 views
-2

我試圖用幾個子目錄刪除名爲dinkelsbuhllectura的目錄。無法使用rm -rf刪除目錄

I'using以下命令:

$ rm -rf dinkelsbuhllectura/ 

但不是工作,我得到了一堆告訴我,一定子目錄是不是空的消息。但我已經知道這就是爲什麼我使用-rf選項。

的錯誤是這樣的:

rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects/23: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects/21: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects/da: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects/e6: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects/e8: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects/33: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/objects: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/hooks: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/info: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/logs/refs/remotes/origin: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/logs/refs/remotes: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/logs/refs/heads: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/logs/refs: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/logs: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/refs/remotes/origin: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/refs/remotes: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/refs/heads: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git/refs: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5/.git: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q5: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects/a4: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects/99: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects/4e: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects/08: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects/23: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects/e6: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/objects: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/hooks: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/info: Directory not empty 
rm: dinkelsbuhllectura//nddm-l4d1p2q4/.git/logs/refs/remotes/origin: Directory not empty 

編輯此外應注意:

如果我嘗試在Finder中,它說要刪除此:

The operation can’t be completed because the item 「23」 is in use.

謝謝。

+1

用'sudo'執行它。我遇到過類似的情況,通常是因爲權限問題。在我的情況下 - root已經檢出了github repo,因此所有內容都在'。git'歸根 – sircapsalot

+0

同樣的問題:( – Jeff

+0

你在mac? – CodeWizard

回答

0

正如我在上面的一個提到的。
它與Mac的問題,並由於某種原因某些程序「捕獲」您的文件。

嘗試登錄並註銷它應該解決它。
下面是一些關於它的更多信息:

https://discussions.apple.com/thread/3987969?tstart=0

當程序打開,他們把一個文件sysytem鎖,以防止其他程序同時編輯文件的文件。

這通常是一個快速鎖定,因此可以將文件讀入內存,然後釋放鎖定;但是,有時候程序需要維護一個鎖,或者有一次錯誤可能會阻止鎖被釋放。

發生這種情況時,如果你嘗試編輯或刪除文件系統不會允許它,並會發出你「使用中」錯誤。

修復,這需要退出與應用,的重新發動,但如果你不能弄清楚它是哪個應用程序(或如果它是在OS X中後臺服務),然後重新啓動系統。

這將導致在OS X中的所有進程釋放自己的文件系統鎖定並重新初始化,因此解決這一問題。

-1

當我遇到此問題時,我使用以下應用程序:'What's keeping me'來確定哪個應用程序鎖定了文件。

它從來沒有讓我失望迄今(OSX 10.8),並一直讓我搞清楚罪魁禍首申請解鎖文件。

如果這樣不起作用,您可以隨時使用註銷登錄方式。

+0

不知道爲什麼這個被降低了? –