Deal with escape chars when checking for matches
Posted: 19 May 2025, 15:21
Hello folks,
I have my data split across three different paths (NAS), and I try to keep efficient, and organized.
I have come up with a formatting pattern that would:
* Check if the media that should be renamed is alread present in one of the three possible locations
* If the media is not present, the script should pick up the location that has more space available at the time of the move
Up until now I never realized that this script has a "bug" when the name includes characters that are not accepted, and gets validated in a second step (i.e. : or ?), the lookup for existing resources fails (because the name is different)
Is there any method that I can use to sanitize the expected name already when renaming the pattern?
I have my data split across three different paths (NAS), and I try to keep efficient, and organized.
I have come up with a formatting pattern that would:
* Check if the media that should be renamed is alread present in one of the three possible locations
* If the media is not present, the script should pick up the location that has more space available at the time of the move
Groovy: Select all
{["/path_1", "path_2", "path_3"]
.collect{"$it/Shared Videos/Serie TV/$n" as File}
.sort{ a, b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }
.last()
}/{"Season "+s}/{n} - {s00e00} - {t}{'.'+lang.ISO2}
Is there any method that I can use to sanitize the expected name already when renaming the pattern?