Page 1 of 1

Search and Replace help

Posted: 11 Aug 2015 09:01
by hogwilson
Using search and replace, how do I change file name "The.end.of.trail.com" to

"End Of The Trail.com"

Results would be remove The, all periods to spaces, case changed to title. This would work the same on any file name I night lite (select).

Your help would be greatly appreciated. Larry (registered owner)

Re: Search and Replace help

Posted: 11 Aug 2015 09:33
by highend
Not possible with a single search and replace.
You need a script to do this, like:

For files only:

Code: Select all

    foreach($file, "<get SelectedItemsPathNames |>") {
        $baseName = regexmatches(getpathcomponent($file, "file"), "^.*(?=\.)");
        $ext      = getpathcomponent($file, "ext");

        $baseName = recase(replacelist($baseName, "the.|.", "| ", "|"), "t");
        renameitem("$baseName.$ext", $file);
    }