Help with renaming files

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Help with renaming files Wed Jun 19, 2013 1:00 pm • by GordLacey
I have a rule that watches a folder for a CBR (comic) file, then converts it to a CBZ file.

Here's the rule:

Extension is "CBR"

Do the Following:
Unarchive
Archive
Rename with pattern: "name".cbz

What I'd like to do is retain the original name of the file. The problem I'm having is that many of the CBR files were renamed. The CBR file may be "Happy Day.cbr" but when it's unarchived the folder is named "Happy Day (blah blah blah)." When my Archive action is run, the resulting file is "Happy Day (blah blah blah).cbz" because it's using the name of the folder when unarchived, not the original filename.

Any ideas how to store the original filename to be used during the rename function at the end? I've tried playing around with it, and I haven't been able to figure it out.

Thanks!
GordLacey
 
Posts: 2
Joined: Wed Jun 19, 2013 12:56 pm

Re: Help with renaming files Wed Jun 19, 2013 1:36 pm • by a_freyer
Use a custom token instead:

Code: Select all
if (all) of the following conditions are met for (the file or folder being processed):
     name matches (custom token for name •)

Do the following to the matched file or folder:
     …


Where:

(custom token for name •) is set to 'anything' (...)

Then, use that token in your renaming at the bottom.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Help with renaming files Wed Jun 19, 2013 2:22 pm • by GordLacey
Thank you! I figured there had to be a way to do it. I love Hazel, but I find so much of the power of it hidden away in places I wouldn't think to look.
GordLacey
 
Posts: 2
Joined: Wed Jun 19, 2013 12:56 pm


Return to Support