Showing latest filename in a folder -looking for ideas

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

Moderator: Mr_Noodle

Hi!
I am very pleased with Hazel - ie looking for patterns in a pdf and renaming them accordingly is such a 21st century move.

I have a folder with purchase orders that have incremental names. When I create a new purchse order (sometimes it's a pdf form the order confirmation of the website or some other source) I have to name it incrementally. So I go to the folder and check the latest file there.

Has someone already thought about a solution to automate that? Ie keeping a folder or .txt on desktop with the name of the next increment? Integrating with Tot.app to paste it into a tot text file? In the past I would have liked to use it with the dashboard post-its for example.

Cheers,
Paul
kleep
 
Posts: 11
Joined: Fri Feb 17, 2023 7:47 am

The Rename action has a counter attribute (#) which will increment each time. Not sure if this fits exactly what you want but I suggest playing around with that.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thank you for the suggestion!

I forgot to add that I create the file first, from different sources and add the number on it - before saving with that name. That's why I was looking for a way to look up / copy the latest increment without opening the folder in Finder.

With Sequencial numbering I could just throw the file into the folder and have the right number as a filename, but I like to keep it also printed in the file.

Also, we restart every month, so it's OrderYYMM-###_Company, with sequencial numbering I'd have to restart it every month..

Hope it makes sense!
kleep
 
Posts: 11
Joined: Fri Feb 17, 2023 7:47 am

There's no good easily accessible way to restart the numbering. If you create a new folder to put the files in, the sequence will reset then for that folder.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi, I have found a solution to my need.
It's less about numbering and more about showing the latest filename somewhere else than where it resides.

So I have a Hazel rule that matches any correctly named file and then launches this shell script
Code: Select all
#!/bin/sh

tot 4 -c
basename "$1" > /tmp/BC_name.txt
tot 4 /tmp/BC_name.txt

where tot.sh is https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23.

As a result I have a dot with the latest filename easily accessible:
Image

I could have also named a file on desktop with a script but then I'd have to keep tack of it to delete it when a new file is created.
kleep
 
Posts: 11
Joined: Fri Feb 17, 2023 7:47 am


Return to Support