Move files to Folders with Names found in Files

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

I have many files in a folder that I want to quickly (and regularly) sort into a lot of folders. Each file has the name of the folder that I want the file to go to as the first part of the file till it reaches the character "-" (or dash). Below is the example of the files that I have:

Directory: AAA_AA
File 1: AAA_AA-12-31-2022.txt
File 2: BBB_BB-12-31-2022.txt

When finished, I should have 2 directories: AAA_AA and BBB_BB and the first file should be moved into AAA_AAA and the second file should be moved to BBB_BB.

Can you help?
gcampbel99
 
Posts: 1
Joined: Sat Feb 17, 2024 4:09 pm

Look up match patterns and custom table attributes in the manual.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

It's easy. As mentioned by the chief noodler, use "file name matches xyz". I use that since ages for sorting by date (identifying the date and move files by year only).
kingshill
 
Posts: 12
Joined: Sun Apr 23, 2017 3:11 pm


Return to Open Discussion