Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Using Actions to remove particular files from a folder
noforker
Newbie
Posts: 13
Permalink
Post Using Actions to remove particular files from a folder
on: April 8, 2019, 08:05
Quote

I am working on automating some file maintenance after working on a particular folder. I've been able to automate tagging of files from DGMLive by utilizing Hazel to rename the included PDF artwork file to the date of the release and Automator to extract the text from the PDF and save it as a text file. Yate then uses the file name of the song file to set the title and the extracted text file to fill in other fields, etc. This is all working perfectly for me.

I would like to setup an action that will then clear out the files I no longer want afterwards. Here is what I've done so far…

Get Property Path to Folder > Variable 14
Copy the Variable 14 field to named variable 'Path"
Contents of Folder "\v14" (Files filtered by 'flac,txt') to named variable 'FileList'
Append "/\<FileList>" to named variable 'Path'

Currently, I have a Prompt coming up to display the variables before I add the Trash Items action. The variables show this:

FILE LIST: file.flac/~file.txt
PATH: /PATH TO FOLDER/file.flac/~file.txt

I'm lost on how to get each file in the file list to append to the path to folder.

BTW, I DO want to remove the flac file because I'm using a transcoded version to ALAC in my library.

Thanks,
Neil

2MR2
Administrator
Posts: 1150
Permalink
Post Re: Using Actions to remove particular files from a folder
on: April 8, 2019, 08:38
Quote

There is no "Append to every element in a list". Try this:

Get Property Path to Folder -> Variable 14
Set named variable 'Path' to "\v14"
Contents of Folder "\<Path>" (Files filtered by 'flac,txt') to named variable 'FileList'
Set named variable 'Trash List' to ""
Repeat With named variable 'Item' for the list in named variable 'FileList' (As found) string delimiter "\~" Run inline action 'Form Full Path' grouped (once)
Trash Items in "\<Trash List>"

Start Form Full Path
Set named variable 'Full Path' to "\<Path>"
Append a path component to named variable 'Full Path' of "\<Item>"
Add "\<Full Path>" to the end of the list in named variable 'Trash List' delimiter "⏎"

It's probably a good idea to add an option to return 'full paths' to the Contents of Folder statement.

noforker
Newbie
Posts: 13
Permalink
Post Re: Using Actions to remove particular files from a folder
on: April 8, 2019, 10:25
Quote

I agree that an option to return 'full paths' in the Contents of Folder function would simplify situations like this. It would be important to have the filter capabilities with that option in this case.

Your suggestion worked perfectly.

Thank you for your help, as always!
Neil

2MR2
Administrator
Posts: 1150
Permalink
Post Re: Using Actions to remove particular files from a folder
on: April 8, 2019, 11:11
Quote

It'll be in 4.6.2 and will work regardless of the other settings.

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.037 seconds.