Can't delete file - file name too long

Discussion in 'macOS' started by mishka00, Dec 4, 2008.

  1. mishka00 macrumors newbie

    Joined:
    Nov 17, 2008
    #1
    I've got a file that looks like this
    Code:
    Z¥ÿ␀´Jÿ?.h•þ
    When I tried to delete in Finder, it moves it Trash, but emptying the Trash leaves it in there. I tried rm -fr * in Terminal and got a "file too long" error.

    Any way to get rid of this sucker?

    Thanks in advance

    \Mike
     
  2. rtpub macrumors member

    rtpub

    Joined:
    Sep 9, 2008
    #2
    Can you rename this to something else in Finder prior to the deletion?
     
  3. mishka00 thread starter macrumors newbie

    Joined:
    Nov 17, 2008
    #3
    Nope, "unexpected error -43" happens.

    There needs to be some raw way of getting rid of it, some unix command or raw access to the file system or some such.

    Btw, the file system is FAT32.
     
  4. kct1986 macrumors newbie

    Joined:
    Jun 26, 2008
    #4
    Mike,

    Did you ever find a way to remove that file? I'm having the same problem. It's very annoying.

    Kay
     
  5. mishka00 thread starter macrumors newbie

    Joined:
    Nov 17, 2008
    #5
    Kay,

    This was a while ago, but if I recall correctly, it was a bad file on my Bootcamp partition in Windows XP that was showing up when OS X was running. I booted into XP and on the command line went to the folder where the file was and did del /p /f *. It prompted to delete each file and I only deleted the bad one (I was unable to delete it in Explorer directly and because the name was all messed up you need to del * on the command line).

    Hope this helps,

    \Mike
     
  6. mishka00 thread starter macrumors newbie

    Joined:
    Nov 17, 2008
    #6
    Also, if you do have a Windows partition, boot into it and run chkdsk. If your issue is related to a bad file / file name, it may help to recover from a bad file into one of those FILE000 files and then you can remove them. I'm not positive whether this is what I had to do, but somehow this thought is lodged at the back of my mind, perhaps from my old nightmarish Windows days :)

    \Mike
     
  7. sidewinder macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #7
    Delete the file from the command line using the inode number.

    Got to the directory the file is in and type this:

    ls -il

    The left most column has the inode number. Let's say the number returned is "6679742".

    Issue this command:

    find . -inum 6679742 -exec rm -i {} \;

    When it finds the file it will display the name. Just hit "y".

    That's it.

    S-
     
  8. kct1986 macrumors newbie

    Joined:
    Jun 26, 2008
    #8
    I realized that the file was in the BootCamp partition after I posted my message. Tried removing it from the Mac Terminal, but the system kept returning "file name too long" error for any command(s) I issued. So I booted in to BC Windows, and it did pretty much the same thing giving some "file syntax error" and would not let me delete it. Anyhow, since I only use my BootCamp install occasionally as a testbed, I decided to remove the partition afterall. Parallels serves my purpose with only minor glitches.

    Thanks for all your help!
    Kay
     

Share This Page