howto file numbered filename into numbered folder

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

Moderator: Mr_Noodle

I have created a file filing structure that is numbered from #1 to #64.
Now I want to scan files, give them a name and put suitable folder number, prepended with #, in the filename (for e.g. file-scanned-today #1.pdf.

I would like Hazel to move this file to the right folder (e.g. 1. Bills).

And so on, I would like to achieve for #2 till 50 or more.

There has to be a way to do so without creating 50 rules... Thinking...
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

Search the help for "match patterns". That should probably do what you want.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

So I went through the custom tokens.
And I went through a few other threads.

I think I have reached the stage where my expression is being identified. But I am not able to file it in the folder of my choice.

Here is what my scenario is:

File is Homeinsurance_zz20.pdf.

I can match an expression. As you can see in the image.
I can move the file to a folder.
Then when it comes time to Sort into subfolder, I am unable to select a folder named, "20.Home Insurance". I can create a new folder called 20, of FixedText20, but I do not want to do that. I want to select the folder called "20.Home Insurance".

Can it be done? Please say it can be done!

THank you!

Image
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

I think this is the thread where what I need to do is captured.
But unfortunately, even after reading about apple script some, I am unable to address the problem.

Will appreciate some hand holding on how to put the script referred to in this thread for my needs. I know this is doable and the answer is here.

Noodlesoft Forums • View topic - Sort files into subfolder based on part of a name.
viewtopic.php?f=4&t=1501
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

Looking at it, it seems you want the first part of the name as well. How about creating a custom token to match that (you can have more than one custom token)?
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Looking at it, it seems you want the first part of the name as well. How about creating a custom token to match that (you can have more than one custom token)?


But I do need help.

To clarify again this is what I need:
Move file named "Homeinsurance_zz20.pdf" to the folder "Files" and then to subfolder "20.Home Insurance".
The same rule should also
move file named "Carinsurance_zz21.pdf" to the folder "Files" and then to subfolder "21.Car Insurance".

I have figured out how to extract the numbers 20 and 21 from the files above, but after much research, I am unable to figure out how to sort the files into the appropriate subfolders.

---

My plan is to scan files, give them a name, and then add a zz20 or zz21 at the end of the name so they get auto filed.

Thanks for your help!
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

As I said, why not have another token match the first part of the name?
Code: Select all
  Name matches (•some name)_zz(•foldernumber)
 ...
   Sort into subfolder (•foldernumber).(•some name)
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:As I said, why not have another token match the first part of the name?
Code: Select all
  Name matches (•some name)_zz(•foldernumber)
 ...
   Sort into subfolder (•foldernumber).(•some name)


I am sorry that my file names confused things.

I would also like the same rule to sort the following files.
Car insurance quotations_zz21.pdf to sort into 21.Car insurance
Allstate quote_zz20.pdf to sort into 20.Home insurance

So basically, the file name does not include the entire folder name.
It just includes a portion of the folder name - the serial number of the folder.
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

In that case, I guess you have to hard code it into individual rules since there's no pattern there.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Do you think trying to write a shell script or an apple script may be a better idea?
Would it be better to try and do it from within Hazel?

If I should use a script, any hints? Thanks!
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm

I can't say. I don't know what your logic is for mapping those file names to the folder but most anything is doable via a script. If you don't know how to write scripts, though, that's beyond the support I can give but maybe someone else with some extra time on their hands can chime in here.
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I can't say. I don't know what your logic is for mapping those file names to the folder but most anything is doable via a script. If you don't know how to write scripts, though, that's beyond the support I can give but maybe someone else with some extra time on their hands can chime in here.


Fair. Need to work on an applescript that I can use - and I will probably call it from within Hazel by passing the file name to the apple script.
jim80
 
Posts: 23
Joined: Tue Aug 28, 2012 5:47 pm


Return to Support