How do you know where items in the Trash came from?
I have a lot of items in the Trash. I would like to determine where these items were before they were discarded.
MacBook Air 13″, macOS 11.3
I have a lot of items in the Trash. I would like to determine where these items were before they were discarded.
MacBook Air 13″, macOS 11.3
jjjefff wrote:
This is interesting...I have a lot of files in my Trash. Some files have "Put Back" and some do not. I'm not sure why they differ.
You've probably deleted the directory it was originally in. In that case, you really can't put it back because there is no place for it to go.
The bottom line here is that the trash is the trash. Once something is there, it's a bit late to start your review of whether it should be there. It's not absolutely too late. You can drag things out of the trash. In many cases, you can simply change your mind and put the items back. But once you reach the point where you effectively have a trash filing system, then you've gone beyond its designed functionality. Bummer to be you.
Your options:
1) Empty the trash
2) Put back what you can and #3 or #4 the rest
3) Drag the items out of the trash, re-organize them, and move them somewhere else
4) Write a parser for DS_Store using something more powerful than sed. Use that to recreate the original file system and restore all the files back to where they originally lived. Note that nothing about the DS_Store file was ever documented by Apple. If you weren't already a software developer, you'll be able to claim the title when you're finished.
I recommend #3. Obviously you put them in the trash for a reason. It sounds like you no longer trust your reasoning. OK. Fair enough. Review the files and in the case of any doubt, move the file to some new location that seems appropriate.
Or, from your linked entry, the following Terminal syntax, tailored to the user's Trash folder, with an additional Perl regex to reduce the output to just the original file locations:
xxd -p ~/.Trash/.DS_Store | sed 's/00//g' | tr -d '\n' | sed 's/\([0-9A-F]\{2\}\)/0x\1 /g' | xxd -r -p | strings | sed 's/ptb[LN]ustr//g' | perl -lne 'print "$2$1" if $_ =~ /(.*)\)(.*$)/;'
System/Volumes/Data/Users/viking/Desktop/kant_jacobian copy 2.docx
System/Volumes/Data/Users/viking/Desktop/kant_jacobian copy 3.docx
System/Volumes/Data/Users/viking/Desktop/kant_jacobian copy.docx
Tested: Ventura 13.5.1
"It's complicated" remains an understatement… 🤓
Has the user every attached and external Drive to this machine ?
Has the user every deleted files from that external Drive ?
As the User forgotten to Empty the Trash ( Bin ) before dismounting the External Drive ?
Once that Exact Some External Drive is re-attached to the Computuer - the Trash (Bin ) would appear with those previously Deleted Files
jjjefff wrote:
The search feature does not find *any* DS_store files.
I don't know what you mean about a "search feature". The vast majority of files in the operating system, especially those DS_Store files are hidden from virtually all "searches". I only included that link as a demonstration of how complicated this is. I probably shouldn't have even done that. Those kinds of things can give people false impressions. For example, "the Trash" is not a folder. It is a "Finder artifact". It doesn't really exist. You may accidentally stumble upon some partial implementation detail like a hidden ".Trash" directory in your home directory. But that's not the the trash. That's a partial implementation detail. It's much more complicated than that.
It’s complicated. Here is a post from a few years ago that described how it worked back then. I may be same now. Could be different.
jjjefff wrote:
Terminal returns "Operation not permitted".
I can't even find ~/.Trash/.DS_Store among my hidden files. Is this further hidden in a way I cannot access it?
Don't worry about it. The terminal command only worked due to random luck. It's really not possible to parse files that way.
This is based on my moving three files to my Trash from the Desktop with Finder several minutes before I ran the Terminal command from my home directory. That gave Finder time to create the hidden .DS_Store in my Trash folder. I also have Full Disk Access permissions for the Terminal set in my System Settings : Privacy and Security panel.
I continue to agree with etresoft that this is no way to run a railroad…
Terminal returns "Operation not permitted".
I can't even find ~/.Trash/.DS_Store among my hidden files. Is this further hidden in a way I cannot access it?
I don't think the new Macs have the "Put Back" feature anymore...or am I just not seeing it? 🙈
jjjefff wrote:
I don't think the new Macs have the "Put Back" feature anymore...or am I just not seeing it? 🙈
Mine do…
This is interesting...I have a lot of files in my Trash. Some files have "Put Back" and some do not. I'm not sure why they differ.
It depends on their origin. For example, you cannot put back files from a Time Machine backup.
I like your logic 🥲
I can't find the DS_Store file in the Trash or in any other folder.
The search feature does not find *any* DS_store files.
How do you know where items in the Trash came from?