Skip to main content
added 1064 characters in body
Source Link
jksoegaard
  • 79.6k
  • 4
  • 133
  • 204

If you for example look at the attribute in Terminal using the xattr command, you'll find that there it is named "com.apple.lastuseddate#PS" with #PS" meaning that the attribute "sticks" to the file when it is copied or synced. Just copying the file alone won't remove the last used date from it - the timestamp would be copied along with the file contents.

You can delete the attribute from the file like this:

xattr -d com.apple.lastuseddate#PS myfile

However, the attribute is still shown in Finder, and so the file still appears in the Recents folder.

A "somewhat simple" way of getting a file out of the Recents folder is actually to copy it in the Terminal using the cp -X command, which copies the file without the metadata attributes. You would then remove the old file and rename the copy back to the original name. As an example a file named myfile.wav could have its last used attribute removed like this:

cp -X myfile.wav myfile.wav.copy
rm myfile.wav
mv myfile.wav.copy myfile.wav

Note: This also removes other attributes on the file - so be careful if there's something there you want to preserve.

If you want to delve even more into the technical details of the "Recents" folder, you should note that the folder in Finder is actually simply a saved Spotlight query. You can review the saved searches used by Finder by opening this folder in Finder (by using the Go menu in Finder and choosing "Go to Folder..."):

If you want to delve even more into the technical details of the "Recents" folder, you should note that the folder in Finder is actually simply a saved Spotlight query. You can review the saved searches used by Finder by opening this folder in Finder (by using the Go menu in Finder and choosing "Go to Folder..."):

If you for example look at the attribute in Terminal using the xattr command, you'll find that there it is named "com.apple.lastuseddate#PS" with #PS" meaning that the attribute "sticks" to the file when it is copied or synced. Just copying the file alone won't remove the last used date from it - the timestamp would be copied along with the file contents.

You can delete the attribute from the file like this:

xattr -d com.apple.lastuseddate#PS myfile

However, the attribute is still shown in Finder, and so the file still appears in the Recents folder.

A "somewhat simple" way of getting a file out of the Recents folder is actually to copy it in the Terminal using the cp -X command, which copies the file without the metadata attributes. You would then remove the old file and rename the copy back to the original name. As an example a file named myfile.wav could have its last used attribute removed like this:

cp -X myfile.wav myfile.wav.copy
rm myfile.wav
mv myfile.wav.copy myfile.wav

Note: This also removes other attributes on the file - so be careful if there's something there you want to preserve.

If you want to delve even more into the technical details of the "Recents" folder, you should note that the folder in Finder is actually simply a saved Spotlight query. You can review the saved searches used by Finder by opening this folder in Finder (by using the Go menu in Finder and choosing "Go to Folder..."):

added 1064 characters in body
Source Link
jksoegaard
  • 79.6k
  • 4
  • 133
  • 204

The "Recents" folder is not an actual, "physical" folder similar to other folders on your computer. It is a virtual folder, and the contents of it is simply computed when it is viewed. This is why you cannot get rid of the its contents by removing the "Recents" folder from Finder and adding it back in.

The "Recents" folder does not by Spotlight storing a file on your drive containing the most recent items. Therefore there's no way of forcing a re-index of this particular file with a list of recent items.

Instead the "Recents" folder simply works by sorting your files according to their "Last Opened" time (as seen in Finder), and showing the most recent files.

If you want specific files to no longer being the the most recently opened files, you would typically open other files. They would then become the most recently opened files - and eventually the unwanted files would disappear from the list. Another option is to change the "Last Opened" time on those unwanted files, so that they are no longer at the top of the list.

Getting a bit more technical, the "Last Opened" time shown in Finder is actually stored on disk as the file system meta data attribute "kMDItemLastUsedDate". This value is automatically updated by LaunchServices when you either double-click a file, or some application asks LaunchServices to open that file on your behalf.

You can view the "LastOpened" time of a particular file using the Terminal by running a command like this:

mdls -name kMDItemLastUsedDate ~/Desktop/TheFileIWant

Note that not all files have such an attribute. Also note that is not that easy to actually change that attribute.

If you want to delve even more into the technical details of the "Recents" folder, you should note that the folder in Finder is actually simply a saved Spotlight query. You can review the saved searches used by Finder by opening this folder in Finder (by using the Go menu in Finder and choosing "Go to Folder..."):

/System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries

Inside, you'll find a saved search named "Recents" which is really what the Recents folder "is". Using the Terminal, you can review the definition of that saved search like this:

less /System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/Resources/search.savedSearch

In theory you could alter this saved search to exclude the files you want to keep out of the list. In practice, you probably want to mess with system files for such a task. Depending on the macOS version you're running, editing system files could be relatively complicated as well.

The "Recents" folder is not an actual, "physical" folder similar to other folders on your computer. It is a virtual folder, and the contents of it is simply computed when it is viewed. This is why you cannot get rid of the its contents by removing the "Recents" folder from Finder and adding it back in.

The "Recents" folder does not by Spotlight storing a file on your drive containing the most recent items. Therefore there's no way of forcing a re-index of this particular file with a list of recent items.

Instead the "Recents" folder simply works by sorting your files according to their "Last Opened" time (as seen in Finder), and showing the most recent files.

If you want specific files to no longer being the the most recently opened files, you would typically open other files. They would then become the most recently opened files - and eventually the unwanted files would disappear from the list. Another option is to change the "Last Opened" time on those unwanted files, so that they are no longer at the top of the list.

Getting a bit more technical, the "Last Opened" time shown in Finder is actually stored on disk as the file system meta data attribute "kMDItemLastUsedDate". This value is automatically updated by LaunchServices when you either double-click a file, or some application asks LaunchServices to open that file on your behalf.

You can view the "LastOpened" time of a particular file using the Terminal by running a command like this:

mdls -name kMDItemLastUsedDate ~/Desktop/TheFileIWant

Note that not all files have such an attribute.

The "Recents" folder is not an actual, "physical" folder similar to other folders on your computer. It is a virtual folder, and the contents of it is simply computed when it is viewed. This is why you cannot get rid of the its contents by removing the "Recents" folder from Finder and adding it back in.

The "Recents" folder does not by Spotlight storing a file on your drive containing the most recent items. Therefore there's no way of forcing a re-index of this particular file with a list of recent items.

Instead the "Recents" folder simply works by sorting your files according to their "Last Opened" time (as seen in Finder), and showing the most recent files.

If you want specific files to no longer being the the most recently opened files, you would typically open other files. They would then become the most recently opened files - and eventually the unwanted files would disappear from the list. Another option is to change the "Last Opened" time on those unwanted files, so that they are no longer at the top of the list.

Getting a bit more technical, the "Last Opened" time shown in Finder is actually stored on disk as the file system meta data attribute "kMDItemLastUsedDate". This value is automatically updated by LaunchServices when you either double-click a file, or some application asks LaunchServices to open that file on your behalf.

You can view the "LastOpened" time of a particular file using the Terminal by running a command like this:

mdls -name kMDItemLastUsedDate ~/Desktop/TheFileIWant

Note that not all files have such an attribute. Also note that is not that easy to actually change that attribute.

If you want to delve even more into the technical details of the "Recents" folder, you should note that the folder in Finder is actually simply a saved Spotlight query. You can review the saved searches used by Finder by opening this folder in Finder (by using the Go menu in Finder and choosing "Go to Folder..."):

/System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries

Inside, you'll find a saved search named "Recents" which is really what the Recents folder "is". Using the Terminal, you can review the definition of that saved search like this:

less /System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/Resources/search.savedSearch

In theory you could alter this saved search to exclude the files you want to keep out of the list. In practice, you probably want to mess with system files for such a task. Depending on the macOS version you're running, editing system files could be relatively complicated as well.

added 720 characters in body
Source Link
jksoegaard
  • 79.6k
  • 4
  • 133
  • 204

The "Recents" folder is not an actual, "physical" folder similar to other folders on your computer. It is a virtual folder, and the contents of it is simply computed when it is viewed. This is why you cannot get rid of the its contents by removing the "Recents" folder from Finder and adding it back in.

The "Recents" folder does not by Spotlight storing a file on your drive containing the most recent items. Therefore there's no way of forcing a re-index of this particular file with a list of recent items.

Instead the "Recents" folder simply works by sorting your files according to their "Last Opened" time (as seen in Finder), and showing the most recent files.

If you want specific files to no longer being the the most recently opened files, you would typically open other files. They would then become the most recently opened files - and eventually the unwanted files would disappear from the list. Another option is to change the "Last Opened" time on those unwanted files, so that they are no longer at the top of the list.

Getting a bit more technical, the "Last Opened" time shown in Finder is actually stored on disk as the file system meta data attribute "kMDItemLastUsedDate". This value is automatically updated by LaunchServices when you either double-click a file, or some application asks LaunchServices to open that file on your behalf.

You can view the "LastOpened" time of a particular file using the Terminal by running a command like this:

mdls -name kMDItemLastUsedDate ~/Desktop/TheFileIWant

Note that not all files have such an attribute.

The "Recents" folder is not an actual, "physical" folder similar to other folders on your computer. It is a virtual folder, and the contents of it is simply computed when it is viewed. This is why you cannot get rid of the its contents by removing the "Recents" folder from Finder and adding it back in.

The "Recents" folder does not by Spotlight storing a file on your drive containing the most recent items. Therefore there's no way of forcing a re-index of this file.

Instead the "Recents" folder simply works by sorting your files according to their "Last Opened" time (as seen in Finder), and showing the most recent files.

If you want specific files to no longer being the the most recently opened files, you would typically open other files. They would then become the most recently opened files - and eventually the unwanted files would disappear from the list.

The "Recents" folder is not an actual, "physical" folder similar to other folders on your computer. It is a virtual folder, and the contents of it is simply computed when it is viewed. This is why you cannot get rid of the its contents by removing the "Recents" folder from Finder and adding it back in.

The "Recents" folder does not by Spotlight storing a file on your drive containing the most recent items. Therefore there's no way of forcing a re-index of this particular file with a list of recent items.

Instead the "Recents" folder simply works by sorting your files according to their "Last Opened" time (as seen in Finder), and showing the most recent files.

If you want specific files to no longer being the the most recently opened files, you would typically open other files. They would then become the most recently opened files - and eventually the unwanted files would disappear from the list. Another option is to change the "Last Opened" time on those unwanted files, so that they are no longer at the top of the list.

Getting a bit more technical, the "Last Opened" time shown in Finder is actually stored on disk as the file system meta data attribute "kMDItemLastUsedDate". This value is automatically updated by LaunchServices when you either double-click a file, or some application asks LaunchServices to open that file on your behalf.

You can view the "LastOpened" time of a particular file using the Terminal by running a command like this:

mdls -name kMDItemLastUsedDate ~/Desktop/TheFileIWant

Note that not all files have such an attribute.

Source Link
jksoegaard
  • 79.6k
  • 4
  • 133
  • 204
Loading