Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Totally override a folder's name sort order in the Finder Desktop
Basically, this is a glorified example using AppleScript to illustrate a simple method to sort a Finder folder in a non-standard way. You can manually use this method to completely customise the sort order of a folder to override the normal sorting by name, date or kind, etc. The key to the trick is to use and sort by the comments field.

An Example: Tickle File

If anyone out there is as obsessed about organising yourself as I am, you've probably come across the concept of the Tickle File. A Tickle File is nothing more than a sequence of 12 folders (one for each month), and 31 more folders for the days of the month at the front. As each day of the month passes, you look inside the corresponding day folder, act on its contents, and then put the empty folder into the following month. This very simple structure allows you to effectively file things up to a year in advance, confident that they won't be overlooked.

Okay, here's the example - a way to use AppleScript to sort folders named after the months of the year, so that the current month is at the top, with the subsequent months in the correct order, and wrapping around for the start of the next year.

Each morning, when this AppleScript is run automatically by a third party macro tool, it opens my tickle file and makes sure that the sorting is up to date. I act on today's filed actions if there are any, and then drag today's now empty day folder down to the following month. When the next month starts, you look for any tasks/files dumped into the Month folder, and if there are some, sub-file them away in appropriate days of that month if you don't want to act on them immediately.

A stuffed archive of the basic folder structure is available here [thereafter.com.au].

Read the rest of the article for the script...

(If your system uses a language other than English, adjust the month names in both the script and folders accordingly)


property mypath : "Disk:GeneralReference:TickleFile:"
try
 tell application "Finder"
  open folder mypath
 end tell
on error
 set mypath to choose folder with prompt "Please select the folder ¬
 (named TickleFile?) containing the 12 folders with month names..."
 tell application "Finder"
  open folder mypath
 end tell
end try
set mymonths to {"January", "February", "March", "April", "May", "June", ¬
 "July", "August", "September", "October", "November", "December"}

-- Check that it's the right folder...
try
 repeat with n from 1 to 12
  set x to (mypath as string) & item n of mymonths as alias
 end repeat
on error
 display dialog "The TickleFile folder doesn't seem to contain the ¬
 correct 12 months. Stopping script." with icon stop buttons {"Okay"} ¬
  giving up after 10 default button 1
 return
end try

set curmonth to month of (current date) as string
set curmonthnum to monthnum(curmonth)

tell application "Finder"
 set current view of front window to list view
 set icon size of list view options of front window to small icon
 set visible of column comment column of list view options of front window to true
 set width of column comment column of list view options of front window to 0
 set sort column of list view options of front window to comment column
 repeat with n from 1 to 12
  set x to (mypath as string) & item n of mymonths
  set t to ((n - curmonthnum + 13) mod 12)
  if t = 0 then set t to 12
  set comment of item x to t as string
 end repeat
 activate
end tell

on monthnum(mymonth)
 set mymonths to {"January", "February", "March", "April", "May", "June", ¬
  "July", "August", "September", "October", "November", "December"}
 repeat with i from 1 to count of mymonths
  if mymonth = item i of mymonths then
   return i
  end if
 end repeat
end monthnum
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[12,735 views]  

Totally override a folder's name sort order in the Finder | 19 comments | Create New Account
Click here to return to the 'Totally override a folder's name sort order in the Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Totally override a folder's name sort order in the Finder
Authored by: Robert Black on Jun 25, '03 12:22:06PM

Dang! I posted this without being logged in, and realising my mistake, logged in and reposted it under my name. Result: it's author is listed as anonymous. There goes my nanosecond of fame.



[ Reply to This | # ]
Sorry about that!
Authored by: robg on Jun 25, '03 06:04:41PM

I saw both articles in the queue, but didn't notice the change in authorship, so I just deleted one of them. I've now corrected the oversight; enjoy the limelight ;-).

-rob.



[ Reply to This | # ]
Totally override a folder's name sort order in the Finder
Authored by: Gatton on Jun 26, '03 12:23:00AM

I hate to feel stupid and maybe by asking this it just confirms it's not something I need but...
What is this used for again? What I mean is...what actually goes in those folders that might need to be acted on. And how did they get there? I'm assuming you put them there?

Sorry for the dumb question but I think this is a pretty neet trick and I'd use it if I knew what I needed it for :)



[ Reply to This | # ]
Documents, images, etc.
Authored by: robg on Jun 26, '03 01:03:39AM

They can be anything you need to work on on that date. An image to edit; a document to draft; a sales order to review, etc.

-rob.



[ Reply to This | # ]
Totally override a folder's name sort order in the Finder
Authored by: leebennett on Jun 25, '03 12:57:06PM

Hmm, I'd just put 1- 2- 3- etc. in front of all the months. Easier.

Or, you could put 1 through 12 in the comments box for the corresponding folder, enable a column to reveal comments in the window you're viewing in, and sort by the comments column.



[ Reply to This | # ]
Totally override a folder's name sort order in the Finder
Authored by: Robert Black on Jun 25, '03 01:52:16PM
By the way, a cool part of the script above is the three lines that hide the comments column while still sorting by it...

set visible of column comment column of list view options of front window to true
set width of column comment column of list view options of front window to 0
set sort column of list view options of front window to comment column repeat with n from 1 to 12


[ Reply to This | # ]

Totally override a folder's name sort order in the Finder
Authored by: readparse on Jun 25, '03 02:50:24PM

This kind of organi(z|s)ation is something that drives me nuts, but mainly because I've always secretly envied it. I remember when I was an admin geek ("admin" as in paper, not as in systems) in the Air Force we had something called a "Suspense File". Just an accordian file with 31 folders in it. Check it every day and dispose of everything in the file for that day. This is a great automated, year-long version of that and I think it sounds like a great idea. And if the author didn't mention it, I'll expand on it by saying my version will probably have a cron that runs every hour (so it will be sure to run when my computer is on) that will open the Finder folder for today in its own window so it attracts my attention if it has anything in it and isn't already open.

I hereby resolve to implement this as part of my continuing struggle to gain control of my life :)



[ Reply to This | # ]
Totally override a folder's name sort order in the Finder
Authored by: pairaka on Jun 26, '03 06:01:12AM

Could you explain how to do this, please? Setting up my system so that I can have the folder for the current date open automatically at a specified time?

Thanks,

Pairaka



[ Reply to This | # ]
Totally override a folder's name sort order in the Finder
Authored by: LouieNet on Jun 26, '03 08:39:54AM
pairaka wrote:
Could you explain how to do this, please? Setting up my system so that I can have the folder for the current date open automatically...

I would do something with:
set curmonth to month of (current date) as string

to start looking for the correct folder. There's probably something very, very similar for the day of the month.

...at a specified time?

Have a look at cron and osascript to run an Applescript at specifid times and intervals.

---
G4 cube, 1152M RAM, OS X Server 10.2.6

[ Reply to This | # ]

Totally override a folder's name sort order in the Finder
Authored by: LouieNet on Jun 26, '03 08:45:07AM

And how about if there's nothing in the folder, then move the folder to the next month? And if the next month doesn't have that date (29-31), then move it to the next month that has it?

And if it's getting closer to the end of the work day, and there is still stuff in the current day's folder, it can do something else to get your attention...like play a song, etc. :)

---
G4 cube, 1152M RAM, OS X Server 10.2.6



[ Reply to This | # ]
Finder sorting different to shell sorting
Authored by: haighy on Jun 25, '03 03:31:21PM

Incidentally, does it drive anyone else to despair that the Finder doesn't sort files like the shell? In the Finder, files are sorted 0,1,2,3,4,5,6,7,8,9,10,11 etc, whereas in any shell I've ever used they're sorted 0,1,10,100,11,12,13,14 and so on. I work with a lot of graphics where order is crucial, and a little bit of consistency would be helpful...anyone have any ideas? Perhaps this is slated to be a preference in Panther?



[ Reply to This | # ]
Finder sorting different to shell sorting
Authored by: osxpounder on Jun 25, '03 04:14:52PM

I wouldn't say I despair over it, but I am occasionally tripped up by the difference between the Finder sort order and the shell's--I like the Finder better, since it's designed to sort the way humans would, but I can see why shells and other, less sophisticated computer interfaces sort differently. I think if I had the option to make Finder consistent with the shell's method of sorting, I wouldn't use it often, but when I did, I'd want that to be a per-folder setting... so that I wouldn't upset other folders if I just happened to want *this* folder to sort differently.

---
--
osxpounder



[ Reply to This | # ]
Finder sorting different to shell sorting
Authored by: GEllenburg on Jun 25, '03 06:52:54PM

Try this:

ls -lv

Or:

ls -v

I just touched 40 sequential files in my /tmp folder and with the -v switch, they were all sorted numerically rather than by strings.

---
He who does not challenge one's elected decisions today, may find himself challenged by them tomorrow.

[ Reply to This | # ]

Finder sorting different to shell sorting
Authored by: thaigan on Jun 25, '03 07:37:18PM

'ls -v' and 'ls -lv' don't seem to work for me at all; any ideas why?

However, this works for me:
ls | sort -n



[ Reply to This | # ]
Finder sorting different to shell sorting
Authored by: thaigan on Jun 25, '03 07:40:15PM

In fact, this is from the manpage for ls:
-v Force unedited printing of non-graphic characters; this is the default when output is not to a terminal.



[ Reply to This | # ]
Finder sorting different to shell sorting - solved, sorta
Authored by: haighy on Jun 26, '03 04:05:05AM

Thanks for the helpful suggestions...however there still exists a problem in that when recursively processing files using perl and File::Find, they're returned in the default shell order. So if I rename a file in the Finder to insert it in between two existing files, such as calling a file 011 to put it between 01 and 02, they'll be sorted correctly when the perl script runs but not when viewing them in the Finder. If you get me. Anyway, I found that if I named it 01a it'll be sorted identically in both situations. So I've ceased despairing :o)



[ Reply to This | # ]
How many days was that in June? (re: above graphic)
Authored by: Han Solo on Jun 25, '03 05:59:21PM
"Thirty days hath September, April, June and November,...."

Any way to fit that into an AppleScript? I mean, if you're going to be compulsive.... ;)

[ Reply to This | # ]

Up to a year in advance?
Authored by: Bookman on Jun 26, '03 10:25:26AM

This very simple structure allows you to effectively file things up to a year in advance, confident that they won't be overlooked.

I'm afraid I don't get how this works up to a year in advance if you only have one set of folders 1-31. If it's the beginning of June, for example, how do you file something to do at the end of July (or any subsequent month) when the folder with that date is still in the June folder.

Unless the trick is to have folders inside the date folders that are by month. So if it's June 1 and you need to do something on July 15, you simply create a "July" folder inside the "15" folder?

If this seems like a dumb question, you have to realize I am organizationally challenged, but have dreams of a better life. :)


--Books

[ Reply to This | # ]
What is a Tickle File, answered.
Authored by: Robert Black on Jun 26, '03 02:52:03PM
Apologies to everyone for not giving a fuller explanation of how a Tickle File is supposed to work. My intent had been to merely use it as an example of how to sort folders in the Finder in a customised order without resorting to those ugly prefixes we've all tried before.

I personally use two Tickle Files: one made of real folders kept next to my desk, and a computer-based version, which is what I created that script for. Anyhow...

What is a Tickle File?

Well, rather than rewrite what someone else has already written, I'll simply quote them (after a quick search with Google)...

"Take 12 manila folders and label one for each month of the year. Label another set of file folders 1 through 31, one for each day of the month... Put the daily files in front, and behind them store your monthly files. If you prefer, two large accordion files will work just as well.

Now stash all those future to-do items - calls to make, bills to pay, applications to mail - in the appropriate file. A [bill] due in August goes in the "August" folder. If a wholesale account wants you to call them in mid-October, tuck a note in the "October" folder. If the phone bill is due on the 25th, drop it into the #19 folder so there's plenty of time for it to arrive. On the first day of each month, transfer everything in that month's folder into the appropriate day's folder."

From http://www.mainecreative.com/time_management.htm

The script in the hint attempts to help emulate this on the computer merely by sorting the folders in the Finder so that the months are in order, with the current month at the top. This is a simple hack - not a commercial application! I am gratified by the interest and response of everyone who's read the original hint.

If you really want help getting organised, I can't recommend David Allen's book "Getting Things Done" highly enough.

[ Reply to This | # ]