Directory Not Empty and cannot empty Trash

Discussion in 'Mac Pro' started by handymanfordays, Sep 28, 2018.

  1. handymanfordays macrumors newbie

    handymanfordays

    Joined:
    Sep 28, 2018
    #1
    There are folders inside my Trash bin with one file all the on the bottom of those folders. I have tried many numerous ways to get rid of this folder (SUDO, rm -rf, etc) and I've even tried renaming the folder which somehow it allowed me to do that while inside the trash and I even ERASED the hard disk and re-installed El Capitan! But low and behold that !@#$%% file is STILL IN THERE IN THE !@##$% TRASH! Just for your information that folder I'm trying to get rid of was from other hard drive volumes so I'm suspecting there must be some kind of linking information that doesn't want to go away. I tried to go on YouTube to look at some solutions but quite honestly the Terminal Command Utility is a little over my head so I'm asking help from all the Guru Gods out there. I need to delete those damn files because each time I trash other files, they get deleted but that cursed folder with that cursed file is still in there! I tried the "Get INFO" approach on each of the folders and put the permissions "on" for Everyone to read and write thinking that would help but alas no use. I keep getting an error code of "-50" and "Directory Not Empty" so I am at my wits end. I think that if I do find a solution to this problem, moving forward from now on I will use the "Secure Empty" Trash because Lord knows I don't want to go through this stress again! I have included a snapshot of the folder and it's duplicates. The reason that it appears duplicated is that each time I try to move the file from the trash it somehow stays in the Trash and a COPY of the folder is duplicated on my Desktop! WTF??? I also have a snapshot of the Terminal utility I tried to use. I would be so eternally grateful for anyone to help me solve this once and for all.

    Last login: Fri Sep 28 14:56:52 on ttys000

    Juans-Mac-Pro:~ juansantiago$ rm -rf /Volumes/2TB\ HD/.Trashes/501/get

    rm: /Volumes/2TB HD/.Trashes/501/get/simple/argg/styyu/Choir Burst␀␀: Invalid argument

    rm: /Volumes/2TB HD/.Trashes/501/get/simple/argg/styyu: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/simple/argg: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/simple: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple/argg/styyu/Choir Burst␀␀: Invalid argument

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple/argg/styyu: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple/argg: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get: Directory not empty

    Juans-Mac-Pro:~ juansantiago$ diskutil list

    /dev/disk0 (internal, physical):

    #: TYPE NAME SIZE IDENTIFIER

    0: GUID_partition_scheme *250.1 GB disk0

    1: EFI EFI 209.7 MB disk0s1

    2: Apple_HFS SAMSUNG 750 EVO 250G... 249.2 GB disk0s2

    3: Apple_Boot Recovery HD 650.0 MB disk0s3

    /dev/disk1 (internal, physical):

    #: TYPE NAME SIZE IDENTIFIER

    0: GUID_partition_scheme *2.0 TB disk1

    1: EFI EFI 209.7 MB disk1s1

    2: Apple_HFS 2TB HD 2.0 TB disk1s2

    /dev/disk2 (internal, physical):

    #: TYPE NAME SIZE IDENTIFIER

    0: GUID_partition_scheme *250.1 GB disk2

    1: EFI EFI 209.7 MB disk2s1

    2: Apple_HFS JUAN 250GB SSD 249.2 GB disk2s2

    3: Apple_Boot Recovery HD 650.0 MB disk2s3

    /dev/disk3 (internal, physical):

    #: TYPE NAME SIZE IDENTIFIER

    0: GUID_partition_scheme *320.1 GB disk3

    1: EFI EFI 209.7 MB disk3s1

    2: Apple_HFS MAIN HD 319.2 GB disk3s2

    3: Apple_Boot Recovery HD 650.0 MB disk3s3

    /dev/disk4 (external, physical):

    #: TYPE NAME SIZE IDENTIFIER

    0: GUID_partition_scheme *2.0 TB disk4

    1: EFI EFI 209.7 MB disk4s1

    2: Apple_HFS TOSHIBA 2T 2.0 TB disk4s2

    /dev/disk5 (external, physical):

    #: TYPE NAME SIZE IDENTIFIER

    0: GUID_partition_scheme *1.0 TB disk5

    1: EFI EFI 209.7 MB disk5s1

    2: Apple_HFS CUBASE 6 499.9 GB disk5s2

    3: Apple_HFS CUBASE 8 499.3 GB disk5s3

    4: Apple_Boot Recovery HD 650.0 MB disk5s4

    Juans-Mac-Pro:~ juansantiago$ ls ~/ .Trash

    .Trash:

    get simple


    /Users/juansantiago/:

    Creative Cloud Files Downloads Music

    Desktop Library Pictures

    Documents Movies Public

    Juans-Mac-Pro:~ juansantiago$ ls ~/.Trash

    get simple

    Juans-Mac-Pro:~ juansantiago$ ls ~/.Trash

    get simple

    Juans-Mac-Pro:~ juansantiago$ ls ~/.Trash

    get simple

    Juans-Mac-Pro:~ juansantiago$ sudo mv folder_error/ .local/share/Trash

    Password:

    mv: rename folder_error/ to .local/share/Trash: No such file or directory

    Juans-Mac-Pro:~ juansantiago$ sudo -rm /Volumes/2TB\ HD/.Trashes/501/get

    usage: sudo -h | -K | -k | -L | -V

    usage: sudo -v [-AknS] [-g groupname|#gid] [-p prompt] [-u user name|#uid]

    usage: sudo -l[l] [-AknS] [-g groupname|#gid] [-p prompt] [-U user name] [-u

    user name|#uid] [-g groupname|#gid] [command]

    usage: sudo [-AbEHknPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user

    name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]

    usage: sudo -e [-AknS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user

    name|#uid] file ...

    Juans-Mac-Pro:~ juansantiago$ sudo rm -rf /Volumes/2TB\ HD/.Trashes/501/get

    Password:

    rm: /Volumes/2TB HD/.Trashes/501/get/simple/argg/styyu/Choir Burst␀␀: Invalid argument

    rm: /Volumes/2TB HD/.Trashes/501/get/simple/argg/styyu: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/simple/argg: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/simple: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple/argg/styyu/Choir Burst␀␀: Invalid argument

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple/argg/styyu: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple/argg: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST/simple: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get/ST: Directory not empty

    rm: /Volumes/2TB HD/.Trashes/501/get: Directory not empty

    Juans-Mac-Pro:~ juansantiago$

    Trash File Screen Shot.png
     
  2. Dr. Stealth macrumors 6502a

    Dr. Stealth

    Joined:
    Sep 14, 2004
    Location:
    SoCal-Surf City USA
  3. handymanfordays thread starter macrumors newbie

    handymanfordays

    Joined:
    Sep 28, 2018
    #3
    Tried downloading Trash It! (the latest version 4.1) and still nothing. Tried to restart and get rid of that 24U Appearance OSAX.osax per their Read Me instructions because it's from an older OS system, restarted and still doesn't work. The way I understand it is you have to double click on the Trash it Icon to delete what's in your system trash but nothing happens. Here's a screenshot of what happens when I double click the Trash It Icon:

    I appreciate your response, thanks much.
     

    Attached Files:

  4. crjackson2134, Sep 28, 2018
    Last edited: Sep 28, 2018

    crjackson2134 macrumors 601

    crjackson2134

    Joined:
    Mar 6, 2013
    Location:
    Charlotte, NC
    #4
    I’ve had an issue similar to this in the past. I use an app called MainMenu Pro. It’s no longer being sold, but you can download it for free (from the maker) and give it a try. It still works well for me. One of the handy functions is a forced trash empty. It has NEVER failed me.

    http://mainmenuapp.com/
     
  5. Fowl macrumors newbie

    Joined:
    Sep 28, 2018
    #5
    I remember this well. I had a few files like that too. The issue is those little NUL things at the end of the file name (technically, the name string contains zeros). I think mine had come from an older, pre-OS X installation, but I am not sure.

    There is a bug in macOS which doesn't let you delete these files, move them, or rename them. I had these files for a year or more and tried everything. As far as I can tell, I'm sorry to say, there is nothing you can do to get rid of them individually. What I did was move the containing folders to another folder called something like "unerasable files", and kept it someplace where it won't annoy me, and so the Trash doesn't always appear full. Then, the next time I upgraded the hard drive, I copied everything to the new drive (with Carbon Copy Cloner) except for that bad folder. I then swapped drives, and erased/reinitialized the old drive.

    I filed a bug with Apple. That was several years ago. If you file the same bug, too, that has a small chance of catching their attention so they fix it eventually.
     
  6. Ludacrisvp macrumors regular

    Joined:
    May 14, 2008
    #6
    I've found a post that claims to have been able to delete it from Windows in your situation.

    Can you rename the file using find and the inode number then delete it?

    Code:
    macpro-osx:test ludacrisvp$ ls -li crappy-filename
    8591845655 -rw-r--r--  1 ludacrisvp  staff  420 Sep 28 22:43 crappy-filename
    macpro-osx:test ludacrisvp$ find . -inum 8591845655 -print0 | xargs -0 -I '{}' mv '{}' Delete_me
    macpro-osx:test ludacrisvp$ ls -l
    -rw-r--r--  1 ludacrisvp  staff  420 Sep 28 22:43 Delete_me
    macpro-osx:test ludacrisvp$ find . -inum 8591845655 -exec mv {} new-filename \;
    macpro-osx:test ludacrisvp$ ls -l
    -rw-r--r--  1 ludacrisvp  staff  420 Sep 28 22:43 new-filename
    --- Post Merged, Sep 28, 2018 ---
    Oh and secure empty Trash is no longer a thing.
     
  7. handymanfordays thread starter macrumors newbie

    handymanfordays

    Joined:
    Sep 28, 2018
    #7
    --- Post Merged, Sep 29, 2018 ---
    Thanks for your input. I understand everything you mentioned but I’m still perplexed on what AFTER I ERASED AND REFORMATTED MY HARD DRIVE AND RE-installed El Capitan, that cursed file was still in my Trash!!! I’m guessing that since I have 4 separate hard drives installed on my 2008 Mac Pro, that devilish evil file is showing up in each of my internal drive’s hard disk but this much I can tell you....I’m not about to erase all those drive and re-install OS El Capitan along with my programs on all of them! Your idea of making a separate folder and labeling it “Unerasable” is a great idea but every time I drag those files out from the Trash it doesn’t empty out the Trash, it just copies the file like the demon from Hell that is is! Mind you, whenever I Trash other items into my Trash, THOSE items get erased but those demon folders are still there! By far, in all my years of working on the Mac since System 6 (on an old Performa), I never had an issue with the Mac that I couldn’t solve except for this one. But then again I never owned a Mac with several hard disks in one machine before until just these past 3 years. Regardless, Mac will always rule especially when it comes to the creative arts.
     
  8. pl1984 macrumors 68020

    Joined:
    Oct 31, 2017
    #8
    What happens if you remove all of the drives except for the OS drive? Given you erased the OS drive and the problem persists I would say the problem exits on one of those drives. Removing them should answer that question.

    If you really wish to erase a hard drive then you can use the following from a terminal window from an OS which is not booted from the hard disk in question:

    WARNING: This command will erase all the information on the target drive and will not be recoverable. Use at your own risk!

    sudo dd if=/dev/zero of=/dev/disk1 bs=4k​

    Substitute the drive letter of the drive you want to erase for "disk1" (I used disk1 as it is the boot drive in your example, it may be a different number if you boot from an alternate disk). I also specified a block size of 4 kilobytes (bs=4k) as disk1 appears to be an SSD. You can substitute a block size of 4 megabytes (bs=4m) if the disk you want to erase is a traditional spinner.

    Alternatively if you have the drive manufacturers software you can issue a secure erase command (which is preferred over the above due to wear leveling in SSDs).
     
  9. handymanfordays thread starter macrumors newbie

    handymanfordays

    Joined:
    Sep 28, 2018
    #9
    --- Post Merged, Sep 29, 2018 ---
    Very clever about removing the hard drives one by one to find the one with the offending Trash file. I suppose there is no way to disable my hard drives without going inside the machine to remove them, or is there?

    Also, didn’t know about SSD drives go through more wear than traditional spinning drives so moving forward I will use the secure erase command whenever I empty the trash on those drives.

    This is the first time I’ve actually joined a forum group of any kind and I must say, I should have done this years ago...it would have saved me a lot of aggravation and stress not to mention that it’s a virtual community of like minded Mac Geeks. I’m definitely not afraid or too proud to ask for help. Thank you all you Mac aficionados! Now go out there and do that Mac Voodoo that you all do so well! ☮️✌️
     
  10. jbarley macrumors 68040

    jbarley

    Joined:
    Jul 1, 2006
    Location:
    Vancouver Island
    #10
    --- Post Merged, Sep 29, 2018 ---
     
  11. pl1984 macrumors 68020

    Joined:
    Oct 31, 2017
    #11
    Which version of the operating system are you using?
     
  12. Macschrauber macrumors 6502

    Macschrauber

    Joined:
    Dec 27, 2015
    Location:
    Germany
    #12
    Had the same problem with the nul character some years ago. I remember I used an old system, afair 10.7 to erase those files.
     
  13. deconstruct60 macrumors 604

    Joined:
    Mar 10, 2009
    #13
    If it is there after a clean install of the macOS you should be looking into how you've been hacked (or rogue software ) more so than this file. If not there on safe boot but there under a normal boot then it is some program you've installed on your system that stuff something into your folder.

    If you "install" is doing a backup recovery (e.g. TimeMachine) then it will come back because that's what you backed up.

    Erasing is gross overkill for this problem. Way , way , way over the top and unnecessary. But if you do a clean install and start up your system with a safe boot and that cruft is in the /.Trashes your machine ( or OS install image) has been compromised.

    The .Trashes folder is the "Trash" location for the non-boot drives. If you start the system and that boot drive hasn't been mounted anywhere else by another boot drive and there is crap in the .Trashes folder something is very wrong that totally besides the file name.


    "Get Info" using the finder the permission blocker is on the actual .Trashes folder. The relevant permission is not Everyone it is the user. Everything in the Trash folder is assigned to 'unknown' user.




    The root cause issue here is not "Secure Empty". The root cause issue here is the goofy program that put the file on your disk in the first place. /get/blah/blah/blah is suggestive that some program is trying to grab file from some non mac system and put them on your machine. That 'get' process is screwed up, because the filenames were not normalized for the macOS filesystem constraints. Thats the problem. Go 'get' those files again and you'll be right back in the same state.

    [ That this appears on multiple disks in your system is more than kind of odd. If the 'get' is being pointed to on those each of those systems and then pushed into the trash then again is an issue. ]



    The following presumes that you are logged in as user that has Administrator privileges. Also presumes that there is nothing in trash folder that you want. I'm going to list by number. What comes after the number is the command for Terminal ( or Finder). I'll explain below with the corresponding numbers. I'll put some comments after a '#' those aren't the command.


    in Terminal

    1. cd /Volumes/2TB* # go to the root of the '2TB HD' drive.

    2. sudo bash # enter this password for this Administrator user when prompted. The prompt will change when done.

    3. chmod u+r .Trashes # turn on read temporarily.


    Switch over to the Finder.


    4. Go > Go to Folder ....

    then enter /Volumes/2TB HD/.Trashes/501

    Finder is probably going to turn the 501 part into 'Trash' that is fine.

    5. walk down those folders in the finder until get to one enclosing the problematical "Choir" filename. Select/Highlight the name and do a Get Info on that file.

    6. In the Get Info window go to the "Name and Extension" property and change something like:

    DeleteMe_12345678901234567890


    Then close that Finder window.

    Go back to the Terminal window


    7 rm -rf .Trashes/501


    If there are other crappy named files clean those up. If this finishes then clean up.


    8. chmod u-r .Trashes # turn off read of Trashes.

    9. exit # shell prompt should change back to what it was.

    10. cd # go back to home directory.


    Longer comments.

    1. Volume Names with spaces in them are pain for command line problem. You have to 'backquote' the space as part of the name. You can do 'tab' completions for the bash shell to fill those in but just chucking the long path names from the process is why moving to the

    This command presumes you don't have another drive with the prefix '2TB' The '*' just matches the rest without typing it.


    2. Similar. There are a couple of sudo commands to make. Not really a best practice but in this context better just to start a whole bash shell as root. As long as in this new shell instance have super-duper powers..... so stick to the directions, you can blow away alot of stuff in this mode.

    The 'sudo' part wants the admin password (if this is the first sudo command given ). The prompt will change to something different.


    3. Going to make this so the Finder can actually 'read' the .Trashes folder. Normally the read is off for very good reason. Going to have to undo this at the end the procedure.

    4. Going to do part of this with the Finder since probably more comfortable than the command line and because the Finder can probably get to the file without stumbling badly on the name. [ I din't directly test this part because don't have grossly screwed up filesnames. ]

    Your admin user ID is 501. Each user has a folder in this directory. Other users might have problems with a different number.

    5. Traverse down to 'bad' file and do a get info to get to a window with the files metadat present.

    6. Change the name of the file to something that isn't the root cause of the problem. Close the finder window when finish so there are no Finder windows 'using' that trashes folder subfolders.

    Doing this on the command line is a bit problematical because the file name is messed up and the commands all want to process the name to 'lookup' what to operation on. For example

    mv foo.txt bar.txt.

    to change 'foo.txt' to 'bar.txt' you have to use the name 'foo.txt'. The name itself is the core of the problem.

    7. Try to nuke the Trash . ( could try from the finder but the command line should more cleanly identify lingering issues ). Since the command is already local to that specific Volume you don't need the prefix of that path when issuing the command ( the '/Volumes/2TB HD/' is implicit).

    If there are still other file names to change then can chase them down in a new Finder window

    8 Undo the 'read' on .Trashes.

    9. kill off this super-power root shell. Shell prompt should change.

    10. put the current directly back to where it was when first opened terminal.
     
  14. handymanfordays thread starter macrumors newbie

    handymanfordays

    Joined:
    Sep 28, 2018
    #14
    --- Post Merged, Sep 29, 2018 ---
    Wow, thank you so much for this. You must be one of the Master Gods of the Terminal Command Universe!
    I will give this a try and give you an update. I guess everything happens for a reason...had I not had this annoying problem with my Mac, I wouldn’t have had the foresight to join this forum which so far has been more helpful than any of the “Apple Geniuses” at the Apple store (Actually, that’s not correct for me to say...I only asked two people there and they really were not sure of what advise to give me other than reformat all my drives which is too time consuming and cumbersome to undertake). Moving forward, this Forum will be my “Go To” whenever I have issues or concerns regarding the highly tech world of Macs! ☮️✌️
     
  15. Macschrauber macrumors 6502

    Macschrauber

    Joined:
    Dec 27, 2015
    Location:
    Germany
    #15

Share This Page

14 September 28, 2018