Offering to the MacUnix Darwin Gods...

Posted:
in Genius Bar edited January 2014
Hello:



I have a nasty file that I'm trying to delete via terminal.



It is on my external hard drive that I have connected to my airport via ethernet. Being that I was really impressed with myself over this feat, I proceeded to fill it with all things mac and backup.



Unfourtunately, the mac Gods laugh at my feeble attempts to place things here since six folders refuse to be deleted from the external drive. They are all (seemingly) empty folders that I can rename and put stuff into (and then take out) but I cannot delete them. I get the usual 'Directory not empty' bullsh.. for whatever reason (even though I don't see anything in the GUI in them at all).



So, here's what I tried to attempt via looking up on previous genius approaches to this issue:



(via Terminal)



Panthera-Tigris:/ Deerslayer$ cd /Volumes/WORKGROUP\\;EDMINI/Trash\\ this\\ 6/

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI/Trash this 6 Deerslayer$ pwd

/Volumes/WORKGROUP;EDMINI/Trash this 6

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI/Trash this 6 Deerslayer$ rm -r *

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI/Trash this 6 Deerslayer$ cd ..

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI Deerslayer$ rmdir /Volumes/WORKGROUP\\;EDMINI/Trash\\ this\\ 6/

rmdir: /Volumes/WORKGROUP;EDMINI/Trash this 6/: Directory not empty

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI Deerslayer$ pwd

/Volumes/WORKGROUP;EDMINI

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI Deerslayer$ cd /Volumes/WORKGROUP\\;EDMINI/Trash\\ this\\ 6/

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI/Trash this 6 Deerslayer$ pwd

/Volumes/WORKGROUP;EDMINI/Trash this 6

Panthera-Tigris:/Volumes/WORKGROUP;EDMINI/Trash this 6 Deerslayer$ rm -r *

rm: *: File name too long



I don't even know what that 'File name too long' is supposed to mean. I tried to zap everything inside it and then cd .. but to no avail.



Anybody else got an in with the Darwin Gods?



Thanks



Dan (letsgonative)

Comments

  • Reply 1 of 4
    First, if you haven't already, reboot the AirPort and that hard drive. And maybe your computer, too. Then try trenaming those directories, replacing all the spaces with underscore (_). Then try removing all that stuff again.



    The easiest solution, though, would be to connect the hard drive directly to your computer. Things can get very messy when long path names are involved in SMB shares.
  • Reply 2 of 4
    Quote:
    Originally Posted by gwoodpecker


    First, if you haven't already, reboot the AirPort and that hard drive. And maybe your computer, too. Then try trenaming those directories, replacing all the spaces with underscore (_). Then try removing all that stuff again.



    The easiest solution, though, would be to connect the hard drive directly to your computer. Things can get very messy when long path names are involved in SMB shares.



    Yes! THank you for your advice...I tried what you said, but it doesn't work that way at all.



    I think what is going on is that the folders somehow have been flagged 'in use' permantly on the hard drive....even when I try to rm -r * them, they stubbornly plant their roots. What's so weird is that message "file name too long".....I mean, I typed '*'....that means everythiing....how much shorter can I get?



    Any other offerings to the God of Pain?



    Dan
  • Reply 3 of 4
    You could try " rm -rf * " inside the directory containing the stubborn folders. The -rf flag "force" deletes everything inside that specific folder. Be absolutely sure, though, in which directory you are before doing this!!!



    One more thing, when you're inside that directory and type " ls -l " (LS -L), is there a folder called ".AppleDouble" or something else with " .Apple... " ? If so, then you must delete those first. Use " rm -rf .Apple* " do do so. I don't know exactly what hard drive you have, but it might be some kind of Linux NAS box that creates those hidden sub-folders. Removing them usually helps, but I'm not sure if you're running into some kind of permissions problem - IF that is a Linux box.
  • Reply 4 of 4
    kickahakickaha Posts: 8,760member
    Alrighty, I'll take a crack.



    1) If this is an external drive over AirPort, am I to assume it is a standalone drive? ie, a NAS or some such? Or is it attached to another computer? It'd be useful to know what that other computer's OS is. Looks like an SMB shared drive from the WORKGROUP; prefix.



    2) If so, note that SMB (or is it the underlying file system, which is usually FAT32 and/or NTFS? I can't recall) has a 255 character file length limit *including the pathname*. SO if you have a folder nested 254 layers deep, and each folder above it has a *one character* name, you *still* cannot make a folder with so much as a two character name down there. MacOS X also has a 255 char limit... *per level*. This can cause problems when the two collide.



    3) It's not the length of the '*' that matters, but what it expands to, that the rm is complaining about.



    4) I notice you didn't do an 'ls' to show us everything in that folder. Might it have another folder in it, which has another folder in it, etc, and somewhere down in there the 255 limit is being hit? That's my guess.



    5) Try this instead: Instead of 'rm -r *' inside the folder (which expands out to the individual names), try 'rm -rf Trash\\ This\\ 6' one level above. That forces all the recursion through the folders to be internal to the tool, instead of expanded out in the shell. If the rm tool does a depth-first recursion, this might do the trick for you.



    6) If *that* doesn't work, try *manually* going down into the folders, starting with the deepest one, and issuing the 'rm -rf *' as needed, and work your way back up. The path names will then, at the shell level at least, be appropriately short.
Sign In or Register to comment.