Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there any way to sort all files in a particular directory by date, even ones in subfolders? For example:

drive root -> documents -> mysite -> dev

Drive root contains a bunch of individual files, plus a folder called documents. Documents contains a bunch of files, plus a folder called mysite, and so on. What I want to see is just a list of files sorted by date, from all the folders, rather than having to open each folder separately and seeing only its files sorted by date.

I have Cocoatech's Pathfinder installed, so if it isn't possible in the standard Finder, maybe there's some way to do it in PF?

(If the folder tree were really as simple as my example, it wouldn't be an issue, but what I'm really looking at is a website's build directory, which contains about 5 levels of subdirectories, and I need to see all files sorted by date so that I can move whatever changed today (regardless of which folder it's in.)

share|improve this question
add comment

2 Answers

If you don't mind using the terminal you could try this:

find . -type f -exec ls -lth {} +

This will list files from current directory and all directories below, sorted by modified date. A variant not listing modification date would be:

find . -type f -exec ls -t {} +

But I believe that it would be better to just list the files that have changed the last 1440 minutes

find . -mmin -1440
share|improve this answer
add comment

You could use spotlight to do this.

  1. In Finder, select the folder that contains everything.
  2. File -> Find or cmd+F
  3. Now, you need to do some sort of search or else nothing will show up. Pick something that all relevant files will satisfy, for example "Last modified date is within the last 100 years"
  4. If you aren't already doing so, view the results as a list (View -> as List or cmd+2)
  5. If there is no header that says "Date Modified" you can get one by going to (View -> Show View options) and selecting it in the "Show columns" category.
  6. Click the Date Modified column header to sort by this value.

One thing to consider: Folders also show up in the list. Perhaps you can get around this by requiring size to be greater than 0.

If for some reason spotlight is not working for you, you could do use a python script, like this one:

#! /usr/bin/python

import os, time

for path,dirs,files in os.walk("/path/to/folder"):
  for file in files:
    fullname=path+"/"+file
    mtime=os.stat(fullname).st_mtime 
    mtimestring=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(mtime))
    print "\"" + fullname + "\"," + mtimestring

Save the output to a .csv file and use your favorite spreadsheet program to do the sorting. Or you could alter the script to do the sorting for you.

share|improve this answer
    
OK, so I tried it and it worked for files that are actually on my physical hard drive, but did not work for files on a mounted share, which is what I need. Any ideas? –  EmmyS May 27 '11 at 14:01
    
You could always use a script of some kind. I edited to include a python example. –  Nathan Grigg May 28 '11 at 19:34
    
Thanks. Seems kind of ridiculous that I'd have to resort to a script, but I'll give it a shot. –  EmmyS May 31 '11 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.