Trying to delete a directory stored on a Windows server, from on a Mac, containing files created on the Mac, getting "Directory not empty"
Posted
by
AdamG
on Server Fault
See other posts from Server Fault
or by AdamG
Published on 2013-11-08T15:21:05Z
Indexed on
2013/11/08
15:58 UTC
Read the original article
Hit count: 226
I am trying to delete a directory stored on a Windows 2008 R2 server, mounted on a Mac as network home (10.8.5). The directory was created by Safari and stores temporary internet files. I need to be able to delete this folder on logout from a Mac bash script.
The Terminal on Mac shows the directory as empty:
36W-FacRm-02:History lwickham$ cd /home/lwickham/Library/Caches/Metadata/Safari/History
36W-FacRm-02:History lwickham$ ls -al
total 0
drwx------ 1 lwickham CGPS\Domain Users 264 Nov 8 09:24 .
drwx------ 1 lwickham CGPS\Domain Users 264 Nov 8 09:28 ..
However, on the Windows server it has a single 0kb file that doesn't start with a "." but yet is invisible to the Mac.
E:\FacultyHome2\lwickham\Library\Caches\Metadata\Safari\History>dir
Volume in drive E is FacultyUsers2
Volume Serial Number is 8C17-4EF3
Directory of E:\FacultyHome2\lwickham\Library\Caches\Metadata\Safari\History
11/08/2013 09:24 AM <DIR> .
11/08/2013 09:24 AM <DIR> ..
11/07/2013 04:28 PM 0 http?%2F%2Fwww.google.com%2Furl?sa=t&rct=
j&q=&esrc=s&source=web&cd=6&ved=0CFsQFjAF&url=http%253A%252F%252Fwww.usbanklocat
ions.com%252Fhsbc-bank-usa-96th-street-branch.html&ei=5vR7UtmXEPjfsATe0YCIBA&usg
=AFQjCNF9ypKbpYbXRng00FY3W8Y6cF1Tiw&bvm=bv.56146854,d.
1 File(s) 0 bytes
2 Dir(s) 514,231,967,744 bytes free
9ypKbpYbXRng00FY3W8Y6cF1Tiw&bvm=bv.56146854,d.1 File(s) 0 bytes2 Dir(s) 514,231,967,744 bytes free
All my attempts to delete the dir from the Mac have failed:
36W-FacRm-02:History lwickham$ rm -fr /home/lwickham/Library/Caches/Metadata/Safari/History/*
36W-FacRm-02:History lwickham$ rm -frd /home/lwickham/Library/Caches/
rm: /home/lwickham/Library/Caches//Metadata/Safari/History: Directory not empty
rm: /home/lwickham/Library/Caches//Metadata/Safari: Directory not empty
rm: /home/lwickham/Library/Caches//Metadata: Directory not empty
rm: /home/lwickham/Library/Caches/: Directory not empty
© Server Fault or respective owner