0

I have a usb drive plugged in my Macbook. And I found I have mis-deleted several files, so I

cd /Volumes/MyUsbDrive/.Trashes

and I find a directory named 501, so I

cp -r 501 ~

from terminal, I can see the 501 directory was copied, but it is not visible from Finder. It has a long format of

drwxr-xr-x@

and even I changed the name of it, it does not display in Finder. All its contents are accessible from terminal through.

I use OS X 10.11.6.

Is it a bug in the OS X?

  • As from @Monomeeth, chflags nohidden 501 will make it displayed. And I suggest everyone to use ls -alO to check the flag attributes when your folder is not visible on OS X. – TonyTony Sep 12 '16 at 12:17
  • 1
    If you wanted to see the contents of the hidden directory you could open the hidden directory- open ~/501 – fd0 Sep 12 '16 at 15:50
1

Short answer

No, this is not a bug in OS X.

Long answer

Mac OS X volumes contain quite a few files and folders that are invisible from the Finder. Usually they're hidden for a good reason and most users won't ever need to see them. Basically, because people shouldn't muck around with them unless they know what they're doing, Apple has designed the system to hide them.

501 folder

On volumes other than the boot volume, a .Trashes folder is used to store files & folders that've been moved to the trash but not yet emptied. Because every user has their own personal trash can, subfolders are created under .Trashes for each user, named according to their user ID number. For example, if user #501 throws something on a volume named "Harry" into the trash, it'd be moved to a folder named /Volumes/Harry/.Trashes/501/.

  • But it is not a .501, it just displays as a normal folder in Terminal, without a dot before the name. I didn't see any differences with a normal one. What I mean invisible, is even after the 501 folder is copied from .Trashes to the current user login folder, it is yet not visible. It does not make any sense in this case. – TonyTony Sep 12 '16 at 10:15
  • Yes, but by default permissions on this folder are set so that users can only access a trash can if you can guess the user's ID. The only reason you were aware of it is that you know your way around Terminal and were able to see it and copy it - but copying it hasn't changed the permissions on it. The reason it doesn't have a dot '.' in front of it is that it was located inside the .Trashes directory originally so it didn't need to have the dot. Have you tried changing the permissions? – Monomeeth Sep 12 '16 at 10:31
  • The permission of it is as shown in my question, which is exactly the same with the permission of a normal visible folder. That @ sign is only to show there are extra attributes of this folder, and in some of my visible folders I can also find it displayed. Cannot see any differences in terms of user permission by my knowledge yet. – TonyTony Sep 12 '16 at 10:42
  • 1
    What happens if you use the chflags command with the nohidden flag on the directory? – Monomeeth Sep 12 '16 at 11:07
  • woo! that works, I didn't know there is a flag attributes on OS X. Now it's shown in Finder. Seems Apple has designed to use this flag purposefully for such 501 folders. Many thanks! – TonyTony Sep 12 '16 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .