Moving specific number of files to sub folders

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

Moderator: Mr_Noodle

I have an old Subaru that accepts a USB drive to play music. The limitation is that it can only handle a maximum of 256 files per folder, with a maximum of 256 folder.

I can’t seem to find a post I thought I’d seen in the forum about doing this exact set of actions, but I can no longer find it.

I want to use Hazel to copy a random selection of 256 files from a master directory, then create & name a folder and then copy those 256 files to this new folder. It should continue creating new folders and copying files until all have been copied.

My limited knowledge of Hazel tells me that for each file I copy, I will need to tag the file then copy it to the new folder so that I do not copy the same file again.

Any direction or help figuring this out would be greatly appreciated
Bee Mungus
 
Posts: 8
Joined: Wed Feb 02, 2022 12:19 pm

This type of logic would require a script as there's no way with built in conditions/actions to randomly select files.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:This type of logic would require a script as there's no way with built in conditions/actions to randomly select files.

So could this be done then if the randomized portion was eliminated?
Bee Mungus
 
Posts: 8
Joined: Wed Feb 02, 2022 12:19 pm

Maybe? It heavily depends on how you are grouping them and may only be possible in extremely specific scenarios.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Maybe? It heavily depends on how you are grouping them and may only be possible in extremely specific scenarios.

The source folder is flat with no sub-folders. The destination folders simply need to be filled with say the first 256 mp3 files, then create another folder and fill it with the next 256 files and so on until all source files have been copied. Folder naming is as simple a 1,2,3 etc.
Bee Mungus
 
Posts: 8
Joined: Wed Feb 02, 2022 12:19 pm

I'm not sure if this will work, but you can try a rule using something like "date added is among the 256 least recent and tags do not contain <<some tag>>". The rule itself would set the tag on the file then do the copy (it has to be in that order). I'm not sure how it would create a new subfolder each time though. Ultimately, it might be best to use a script.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support