1

I have no problem making a list of all files in the trash provided those files were previously on the main harddrive, but when those files were previously on an external harddrive I can't access them with Terminal or Python. At first, I ran into permission errors but I've since changed the permissions. For example,

ls /users/me/.Trash

will print out what is actually in the trash. But when I do the following:

ls /volumes/edrive/.Trashes

I just get 503 even though there is a file in there not named 503. For some reason the trash folder is called .Trashes when it's on an external hard-drive. I'm also trying it with Python which is what I want to use anyway:

import os
os.listdir('/volumes/edrive/.Trashes')

Outputs

['503']

1 Answer 1

5

The drive-wide Trash contains the deleted files of all users, with one directory per numerical User ID. Run

ls -l /Volumes/edrive/.Trashes

to see that 503 is a directory, and

ls -l /Volumes/edrive/.Trashes/503

to see its content.

PS: You can see your own user id by running id -u . If it is not 503 you'll need to run sudo ls -l /Volumes/edrive/.Trashes/503 instead.

1
  • 1
    id -u to print current user id
    – Andreas
    Nov 10, 2020 at 2:54

You must log in to answer this question.

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