Welcome Guest

Pages: 1
Using Actions to remove particular files from a folder
noforkerPostApril 8, 2019, 08:05
Newbie
Posts: 17
Registered:
July 25, 2016, 01:03
Normal topicUsing Actions to remove particular files from a folder

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

2MR2PostApril 8, 2019, 08:38
Avatar photo
Administrator
Posts: 2084
Registered:
August 23, 2012, 19:27
Normal topicRe: Using Actions to remove particular files from a folder

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.

noforkerPostApril 8, 2019, 10:25
Newbie
Posts: 17
Registered:
July 25, 2016, 01:03
Normal topicRe: Using Actions to remove particular files from a folder

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

2MR2PostApril 8, 2019, 11:11
Avatar photo
Administrator
Posts: 2084
Registered:
August 23, 2012, 19:27
Normal topicRe: Using Actions to remove particular files from a folder

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

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.014 seconds.