Renaming folders & files in them

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

Moderator: Mr_Noodle

Renaming folders & files in them Sun Aug 19, 2012 6:05 am • by FatherOfAlways
Hi,

I have the following rule set up in Hazel:
http://cl.ly/image/3o0I3B3h0J40

This renames any files I put in the folder I'm running the rule in. My question is, how do I also rename the potential subfolders inside that folder?

Also, since I don't really know anything about HTML, can you also tell me how to directly attach an image to a post?

Any help would be appreciated.
FatherOfAlways
 
Posts: 24
Joined: Sun Aug 19, 2012 5:47 am

Re: Renaming folders & files in them Sun Aug 19, 2012 9:51 am • by Skeo
From what I can see, your problem is that your rule will ALWAYS match the first file. So it will be stuck in an endless loop of renaming the first file it comes across.

Since 'Any File' will run on anything, the 'kind is folder' is redundant (as I understand it)

So, change your match condition to
Code: Select all
If all
Date last matched is blank
Any File


That should work.
For bug diagnosis, or if you have other rules that mess up the date last matched field, you could include a change of label colour in your process and add a rule to only match a certain colour. Then you can visually see which files have been processed and which haven't.

If you are still having issues, try separating out your two processes:

First Rule:
Code: Select all
If all
kind is not folder
date last matched is blank

then
rename


Second Rule:
Code: Select all
If all
kind is folder

then
run rules on folder contents.
Skeo
 
Posts: 31
Joined: Mon Jan 02, 2012 7:53 pm

Re: Renaming folders & files in them Mon Aug 20, 2012 8:11 pm • by FatherOfAlways
Thank you for your reply. I'm quite new to Hazel so your detailed suggestion is much appreciated and worked like a charm.

I now have another problem, though. As you can see from the link, the rule ultimately renames files. They are renamed to "name" + "extension". However, the "extension" part becomes a problem when renaming folders, because Hazel keeps the extension, even though a folder does not need/require one.
How would I go about a rule that would rename files to "name" + "extension" and folders to "name" only?
FatherOfAlways
 
Posts: 24
Joined: Sun Aug 19, 2012 5:47 am

Re: Renaming folders & files in them Tue Aug 21, 2012 12:23 pm • by Mr_Noodle
If the original doesn't have an extension, then there's nothing added on. The default pattern of (name)(extension) basically does not change the file/folder name at all.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming folders & files in them Sat Aug 25, 2012 6:52 pm • by FatherOfAlways
Mr_Noodle wrote:If the original doesn't have an extension, then there's nothing added on. The default pattern of (name)(extension) basically does not change the file/folder name at all.

I understand what you mean, but that does not solve my problem. I'll try to phrase it again, as simply as possible.
I followed the advice Skeo gave me but am now at square one: files inside folders are renamed, however folder names remain unchanged. I want Hazel to rename the folders as well. How should I go about it?
FatherOfAlways
 
Posts: 24
Joined: Sun Aug 19, 2012 5:47 am

Re: Renaming folders & files in them Mon Aug 27, 2012 3:07 pm • by Mr_Noodle
If you want to do stuff to the folders, then add actions to the rule which has the "Kind is folder" condition.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming folders & files in them Wed Aug 29, 2012 5:42 pm • by FatherOfAlways
OK, I figured it out. It seems It was all a matter of putting rules in correct order, which I screwed up.
Ayway, thank you for all the help!
FatherOfAlways
 
Posts: 24
Joined: Sun Aug 19, 2012 5:47 am


Return to Support