Welcome Guest

Pages: 1 2
Renaming non-audio files in subfolders
Andy SPostOctober 13, 2025, 09:36
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Hot topicRenaming non-audio files in subfolders

Hi Barry,

I use the following action to rename support files within an album folder

Version 0.2 - Rename .cue / .log / .xml / .accurip support files in format: Album Artist - Album Name.ext↵

# Constrain Execution to a Single File
Set named variable 'support_ext' to "cue, log, xml, accurip"
Set named variable 'support_name' to empty

Set named variable 'album_artist-album' to "\[Album Artist] - \[Album]"
Replace "·[Mono]" in named variable 'album_artist-album' with ""
Replace ":", match characters in named variable 'album_artist-album' with "-"

Contents of Folder "\!Path to Folder!" (Files filtered by '\<support_ext>') to named variable 'files'
Count Items in named variable 'files' string delimiter "⏎" save in named variable 'count', set state on == 0
if true
    Prompt Critical Alert [cancels] "<m>There are no <s>\<support_ext></s> files in folder:↵…"
endif
# Copy named variable 'path' to Variable 0
Repeat With named variable 'old_name' for the list in named variable 'files' (As found) string delimiter "\~" Run inline action 'rename support files'

Start rename support files
Find all matches for regular expression "(?m)^((?!\\<support_name>).*)(\.)(?i)(cue|log|xml|accurip)" in named variable 'old_name', replace with "\<album_artist-album>\.$L3" to named variable 'new_name', custom escaping
Exit if false
Move non audio files '\<old_name>:\<new_name>' using retained paths

All works fine until I get an album with <Disc #> subfolders. Although I think I may have tasked you with a similar issue in the past, I can't seem to get my head around making bits of code work properly. What I'd like to achieve is to extend the code so that if <Disc #>, then rename the support files in each subfolder, appending " (Disc #)" to the variable 'album_artist-album'.

Your help greatly appreciated!

--
Andy

2MR2PostOctober 13, 2025, 09:47
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Hot topicRenaming non-audio files in subfolders

Hi Andy,

It seems as if the solution would be simply doing another Contents of Folder asking only for folders. Using a regex to trim the list to those starting with Disk # ... then process each folder.

Can you please export and send me the action to support@2manyrobots.com

It'll make things a lot easier.

2MR2PostOctober 13, 2025, 11:50
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Hot topicRenaming non-audio files in subfolders

There were a number of issues.

- the action assumed that only a single folder was loaded
- the action did not check for consistent Album and Album Artist metadata
- the action did not check if there was more than one support file with the same extension in a folder

These issues may have been irrelevant depending on your files and workflow. Regardless, I've fixed them.

Download https://2manyrobots.com/actions/GV-Rename-Support-Files.zip

I've documented the action ... somewhat. The regex you used referenced 'support_name' which was never set. I'm no longer using the regex. It was easier to use lists and do all the renaming on a single statement rather than looping.

I've bumped the version number to 0.3

Let me know if I've missed anything.

Andy SPostOctober 14, 2025, 09:18
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Hot topicRenaming non-audio files in subfolders

First off, apologies for the double email. It wouldn't show in my sent folder and somehow your reply on the forum wasn't showing. Knowing how promptly you usually answer queries, I assumed that you hadn't received my email.

I know my action was pretty rudimentary and unworthy of public display 😆 , but it worked for most of what I wanted when processing a single album after ripping the CD.

Many thanks for your assistance. Your code is much more exhaustive and thorough in execution.
I do have an issue with it though; It never seems to get any match at line 31 (I did change Disk to Disc). The regex doesn't validate and the inline action "process disk folder" never gets executed, therefore I don't get the " (Disc #)" to the variable 'album_artist-album'.

 31:     List Manipulate Filter items in 'folders'(⏎) using text matched by regex "^Disk \d+$" (case insensitive). Save to 'folders'(⏎)

Any idea?

2MR2PostOctober 14, 2025, 10:40
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Hot topicRenaming non-audio files in subfolders

Oops sorry about Disk and Disc. My brain is getting muddled. Disk 🙁 ... Disc 🙂

If you're writing your own actions ... you're doing great. The actions should reflect your workflow as yours did.

I've uploaded v0.4 to:

https://2manyrobots.com/actions/Rename-Support-Files.zip

It seems okay to me. Let me know.

Image
Image

Andy SPostOctober 14, 2025, 12:16
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Hot topicRenaming non-audio files in subfolders

Barry, for some reason I still have the issue mentioned above. If I put a debug statement at the beginning of the inline action "process disc folder", it never reaches that stage and I get the following:

Image
Image

2MR2PostOctober 14, 2025, 12:36
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Hot topicRenaming non-audio files in subfolders

Are you sure that you have v0.4?

Andy SPostOctober 14, 2025, 12:39
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Hot topicRenaming non-audio files in subfolders

Yep. The only change I see between 0.3 and 0.4 are Disk to Disc.

29:     Contents of Folder "\<folder path>" (Folders) to named variable 'folders'

If I put a Debug statement here, the named variable 'folders' is not even showing in the debug panel.

2MR2PostOctober 14, 2025, 12:44
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Hot topicRenaming non-audio files in subfolders

LOL. Conceptual issue on my part. I'm looking at the folders of the loaded files and looking for subfolders named Disc n.

You're loading files in the Disc folders which are named Disc n. I'll change it to operate for your workflow.

Andy SPostOctober 14, 2025, 12:59
Newbie
Posts: 19
Registered:
May 11, 2017, 11:33
Hot topicRenaming non-audio files in subfolders

Not sure I understand.
I load the "Charles Lloyd - (2024) The Sky…" folder into Yate to run the action on.

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