How can I get rid of weird files on a shared folder?
Asked by
gsiener (
454)
January 8th, 2008
On a networked drive, I can see a file but can’t delete it. Issuing an rm -fr on the containing directory says “Directory not empty”, and issuing rm -f on the file itself gives “No such file or directory”
Observing members:
0
Composing members:
0
7 Answers
If it’s in a shared folder, you may not have permission to delete the file…did you check th permission on the file specifically?
Yeah, it’s giving permissions as -rwx———(via osx terminal). This is on a Windows server sharing via samba, and it was actually the sys admin that asked me to check it out. He’s very biased against Macs so I’m trying to figure out how to deal with these files…
Ensure the file isn’t currently being accessed via another computer. You run into problems when it’s currently “open” and you try to delete it.
Can you ls -al to make sure there are no hidden files in that directory.
Also have you tried running a grep to see what application or process is using the file?
If you are sure the file is not important or critical, have you tried to sudo rm -ir filename?
Good Luck!
R
@gsiener, who wrote, “Yeah, it’s giving permissions as -rwx———(via osx terminal).”
What you don’t say is what your userid is compared to what the userid of the file’s owner is. Those permissions only allow the owner of the file to make changes… no one else can even read it.
Additionally, deleting a file in UNIX is technically an action on the directory itself. So you’ll likely need to ensure that your userid has rwx permission on the containing directory. Put another way, if your userid has the necessary permissions on the containing directory, you can delete a file therein that you DON’T have rwx permissions on directly.
As said above, it is likely a permissions issue. If you’re certain you can safely delete all the contents you can always use issue the rm command with sudo assuming you have the root/admin password.
@paulc: That’s interesting… but it makes me wonder. gseiner is attempting to delete files/dir from a shared directory hosted on another machine. Unless he logs on there directly, I wouldn’t expect using sudo on his local machine will be sufficient to remove those items. Am I missing something?
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.