Move file to FOLDER with name containing file's filename

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

Moderator: Mr_Noodle

Hi
The move action does not appear to have any conditional parameters. Does that mean we are suppose to use Apple Script to handle conditional processing?

e.g.
Move file to DESTINATION FOLDER that contains the file's filename. The "file" and the DESTINATION FOLDER that I wish Hazel to move the file to, are in the same folder.

Thankyou for your help.
NoodleNewbie
 
Posts: 34
Joined: Fri Jul 13, 2018 5:17 pm

How about using "Sort into subfolder"? You can use a pattern like "(anything)(name)(anything)" to move it into the first folder it finds containing the file's name.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Great. Thankyou it worked once then I cannot get it to work again.

(anything) = the elipse wild card parameter. So (anything) name (anything) is as per screenshot
Image

Result
First time result = Moved file into the subfolder containing the filename
2nd, 3rd, .. 6th time = Moved file into a newly created subfolder with folder name = name and extension ie "1222345.xls"

For some reason the name parameter is now picking up the extension, whereas the first time it did not.
Hazel thinks name = 1222345.xls
and it should be name = 1222345

I have not intentionally changed anything but I am learning.

Learnt = do not have a space in setting the pattern else you get this message in Console.
[Error] Sorting into subfolder failed: Could not find a matching destination folder.
NoodleNewbie
 
Posts: 34
Joined: Fri Jul 13, 2018 5:17 pm

Note that the folder has to exist if using (anything) in your pattern.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thankyou. Yes, in each of the test cases 1 folder with the match criteria exists.

Troubleshooting showed something odd going on with Hazel ability to detect the "match criteria" in an exsiting folder

Test results
FAIL
XXXX [filename] XXXX
XXXXXXXX [filename]
filename embedded in the folder name OR filename at the very end of the folder name, hazel failed to detect it and thus created new folder

SUCCESS
[filename] XXXXXXXX
ie at the beginning of folder name, hazel detected itand thus moved file into existing folder.
Tested where folder length is very very long and short, both success

Help required.
Is there a limitation or something else going on?
Is there any characters in a folder name that stop Hazel from searching the entire folder name e.g. "-" or "_" ??
NoodleNewbie
 
Posts: 34
Joined: Fri Jul 13, 2018 5:17 pm

Do you need the spaces in the pattern? Note that if there's space in the pattern, at least one space needs to be there in the actual name.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

dance of joy here. Big Thankyou!

space was the problem

changed the hazel rule to be space aware, and received success

FROM
(anything)(name)(anything)

TO EITHER
(anything)SPACE(name)SPACE(anything)
OR
(anything)SPACE(name),(anything)

Both worked. I could not work out how to put 2 patterns that are the possiblities in the folder length. So I set it to the most common.
NoodleNewbie
 
Posts: 34
Joined: Fri Jul 13, 2018 5:17 pm


Return to Support