Renaming based on SD card (or folder) name

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

Moderator: Mr_Noodle

Renaming based on SD card (or folder) name Wed May 18, 2016 6:22 pm • by Simondo
I have many SD cards that I rename with the person whose card it is. I'd like to use the file renaming protocol for video files (in this case) to rename by date, time and the name of the person (ie the name of the SD card that is the target folder for the rules). I only seem to be able to add the entire file path or the name of the sub folder instead of being able to create a generic rule to add to all rules that just inserts the name of the SD card.

To clarify, the SD card called 'Kevin' has a few sub folders, in which is a video. I want to rename it to be 2016-05-18_1521_Kevin.mpg, for instance. At present I have to add 'Kevin' into the rule for each card. I'd like to do that on a generic level. I can either add "//Volumes/Kevin/Aim/Otherfolder/" or "Otherfolder" with the rules now, based on my fumbling testing.

Any ideas?
Simondo
 
Posts: 6
Joined: Thu Sep 13, 2012 8:30 pm

Are the files always the same number of levels below the "Kevin" folder? If so, you can try using multiple nested rules referencing "the enclosing" folder, though there is a limit to how far you can nest. Otherwise, I'll consider adding "monitored folder" alongside "source folder" as another attribute you can use.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Further to this, I have got this working and it is fine - I have several SD cards that work perfectly with this, but I have found that if I rename a card (renaming the card itself) Hazel sometimes doesn't recognise the new name and continues to match the rules for the Original card name.

The SD cards are for drivers in race cars, and I rename the card with the driver who is in the car. This is making me have to manually modify the name of the files produced, which defeats the object. Any ideas?
Simondo
 
Posts: 6
Joined: Thu Sep 13, 2012 8:30 pm

How are you grabbing the card name? Are you using the advice I posted or some other method?
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

So this was working for a while. I can produce rules and video file changes 2 folders or so deep without a problem. All is good.

HOWEVER (!) recently the issues with the cards not being recognised correctly came up. It used to work that the SD card called "Kevin" (named after a driver/client I am working with) would run the rules under 'Kevin' (all rules created fresh when I first insert the card with that name on it). Now it runs rules from the wrong set. Interestingly I noticed it most obviously (repeatably) a few weeks ago where I renamed the card to a different name, but it still ran the rules from the name the card was before. It was like it matched the card by some other means than the name?

Factors:
1: I have a lot of relatively similar sets of rules following a similar format, the distinction between them has been the name of the card itself (So rules relate to Kevin have been processed because I have renamed Kevin's SD card to his name).

2: Rules are simple:
- if it is a folder, run rules on contents
- rename file with (driver=name of card modified for each card), date
- copy or move to a local folder depending on name/client

3: I have been recreating identical rules (rather than copying them from other cards and modifying). I create new rules for a new driver when I get a new one (rename card, create rules from scratch, keeping consistent format). In case duplication caused some mysterious confusion.

4: Different named cards have been working, but most recently I renamed a card from Kevin to Jim and it merrily matches the Kevin rules no matter how many times I check the rename.

Any ideas?
Simondo
 
Posts: 6
Joined: Thu Sep 13, 2012 8:30 pm

Try using patterns instead of re-creating rules for each case. You can use a custom list attribute if you only want it to apply to a specific set of names.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I don't really understand what you mean by that.

This is for a series of (essentially) identical cards in similar usage - the content of the card is generated by the camera automatically and I can't control it. The only way i can get Hazel to treat each card differently was (I thought) by naming the card itself differently.

1: Is there some other way I can do this?

2: Why does Hazel not recognise the card being renamed even though finder does see the new name?
Simondo
 
Posts: 6
Joined: Thu Sep 13, 2012 8:30 pm

How I understand it is you have something like "If Card 'Fred', Rename with 'Fred'" and so on for each card. That seems unnecessary.

Instead, you can use patterns and custom attributes. Abstractly, you can do "If Card (•Card Name), Rename with (•Card Name)" where (•Card Name) is a custom attribute you define to grab the card name. You can use a list attribute if you only want to match against a specific list of names.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming based on SD card (or folder) name Tue Jun 15, 2021 12:06 pm • by Simondo
Ah, ok. Actually I have a separated version.

So I rename the card "fred", then open Hazel and open a new folder with that card selected while mounted. Then I put rules under that folder that are related (ie Fred's name and race car type is within the text of the renaming rule under that folder).

So when the card is inserted (ie when 'fred' folder is present)the rules activate when the SD card is mounted. I have two rules for each card, created when the SD card is present.

i can export these somewhere if this is helpful.

So what is happening is that a master folder has changed name (basically) and Hazel doesn't recognise it isn't the same SD card it was. It applies the old rules, but the mis-identify is at the folder level not the rule level, it seems.
Simondo
 
Posts: 6
Joined: Thu Sep 13, 2012 8:30 pm

If you'd like to send in the rules, I suggest emailing them in to support. If the rules are pretty much the same between cards, though, it really is better to use patterns to cut those down.
Mr_Noodle
Site Admin
 
Posts: 11196
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron