Copy the Name of Items in the Trash Into a Text File

Hello,

With automator, I found a script that cleans downloads folder after 30 days. Furthermore I want to improve this with, after 2 days clean the trash. But before cleaning the trash, is it possible to copy file names "meta data" that are going to be erased into a text file. But, I don't want it to create new text file every time.

See this thread for the mechanics of doing the timed deletion/movement: Select by File Type and Move Them to a New Folder

This wiki entry will help you get the file metadata https://wiki.keyboardmaestro.com/action/Get_File_Attribute?s[]=file&s[]=attributes

And you can easily have KM write that data to a text file using the Write to a File or Append to a File actions. If you need examples, search the wiki or forum for those terms.

thank you very much i will look into that

Hey @opalaoglu,

Welcome to the forum!  :smile:

Here's a very basic macro to do what you ask.

Let me know if you want more information to be logged.

-Chris


Get the Name of Items in the Trash v1.00.kmmacros (6.0 KB)

Thank you very much thank you, it is amazing.

I wish I could write something like that :smiley:

1 Like

Spend 16+ years using the software, and I'll wager it'll become old hat.  :sunglasses:

-Chris

2 Likes

Can this be altered from "TRASH" to a specific file on my Desktop?

Can you please tell me how to reference a file on my Desktop?

Thank you!

Huh? What's the context?

There are a number of methods of referencing files and folders, but the simplest method is to use a relative POSIX Path:

~/Desktop/FileName