Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Libertine Lush

macrumors 6502a
Original poster
Nov 23, 2009
682
2
I have a folder where I place an ever growing collection of my favorite songs. Before I switched to Mac, on Windows, when I wanted to revisit songs I most recently added to the folder, I would sort the songs by the Date Modified and it would order the files I placed in the folder by date.

In OSX, however, there must be a slightly different meaning to "Date Modified," as it does not quite sort my songs by the order they were added. It gets some of it right, but there's plenty of files that are out of order--tune "x", which I know was placed in the folder a week ago is actually listed further down the list with songs placed in the folder months ago.

Is there a way to have OSX sort files in order of the date it was placed in a folder? Neither "Date Modified" nor "Date Created" works 100% as I thought it would. Or is the OSX definition of Date Modified/Created slightly different than Windows?

(Just a guess: Perhaps the date I ripped/purchased an mp3 takes precedence over when I placed the song into the folder in question?)

Thanks.
 
I've found such inconsistencies in Finder from time to time. Are you importing those songs into iTunes? If so, there's a "Recently added" playlist you could use to identify them.
 
Placing a file in a folder doesn't change the file's Date modified, it changes the parent folder's date modified.

If you want to change Date Modified easily, open Terminal and use the "touch" command.

Code:
touch /path/to/file

or you could navigate to the directory you have the files you want to change the Date Modified and do

Code:
touch *
 
It's not an inconsistency. Moving a file doesn't count as modifying it.

You could make a folder action, but I'd have to do some fiddling before I can give you a solution. But the basic idea is have the folder action run the terminal command 'touch' on every new file placed into it. The 'touch' command basically changes the time modified to now.
 
Are you importing those songs into iTunes? If so, there's a "Recently added" playlist you could use to identify them.

I import it without the "copy to iTunes Media Library" option enabled. The problem with the "Recently added" smart playlist is that it includes all new music that's added. I haven't found any way in the smart playlist options for it to only maintain songs that are located within a specific folder. That would be quite perfect for my needs.

If you want to change Date Modified easily, open Terminal and use the "touch" command.

Code:
touch /path/to/file

or you could navigate to the directory you have the files you want to change the Date Modified and do

Code:
touch *

For the first one, I would simply copy and paste "touch /path/to/file," then press Enter in Terminal? What exactly does that command do? Does it also become a permanent setting for the entire OS, whereas the second command will pertain to only the folder I specify?

It's not an inconsistency. Moving a file doesn't count as modifying it.

What are all the actions that count as modifying a file? I found that even renaming a file doesn't count as modifying it, whereas changing the mp3's ID3 info by adding album art appears to update the modifying date.

Since moving (or even renaming) a file doesn't count as modifying, I assume the date I ripped/purchased an mp3 ultimately determines both Date Modified and Date Created, which is why they're both usually identical?

You could make a folder action, but I'd have to do some fiddling before I can give you a solution. But the basic idea is have the folder action run the terminal command 'touch' on every new file placed into it. The 'touch' command basically changes the time modified to now.

I'd like to better fully understand miles' Terminal instructions first, since I'm not familiar with Terminal. So for now, you don't need to figure out a solution. I don't wanna waste your time. Thank you though.
 
I import it without the "copy to iTunes Media Library" option enabled. The problem with the "Recently added" smart playlist is that it includes all new music that's added. I haven't found any way in the smart playlist options for it to only maintain songs that are located within a specific folder. That would be quite perfect for my needs.

Unfortunately there isn't a way to do that with a smart playlist. Although I don't know why you would want to manually manage files, iTunes does a spectacular job (I guess as long as it's on your main drive). What you *could* do is make an AppleScript (quite a simple scripting language for anyone who can think even a little like a programmer), as AppleScript can identify the location of the items in your music library, and update your library. You will have to manually call this script though.

For the first one, I would simply copy and paste "touch /path/to/file," then press Enter in Terminal? What exactly does that command do? Does it also become a permanent setting for the entire OS, whereas the second command will pertain to only the folder I specify?

Type "touch " (with the space) and then drag your file into the terminal window, then press enter. Like I said above, 'touch' is just updating the date modified (because you 'touched' it). It's just for that file. If you want that to do all the files in a folder. Drag the folder with the files in it after the 'touch', then add "/*", press enter. That "/" last bit means that it will look into that folder named before it, then "*" says, "everything": it's a wildcard character.

What are all the actions that count as modifying a file? I found that even renaming a file doesn't count as modifying it, whereas changing the mp3's ID3 info by adding album art appears to update the modifying date.

Since moving (or even renaming) a file doesn't count as modifying, I assume the date I ripped/purchased an mp3 ultimately determines both Date Modified and Date Created, which is why they're both usually identical?

When you change anything inside the file. Moving the file doesn't update the date modified because all you have done is changed it's location, which is a change in the file system records, same goes for renaming. Changing a song's information in iTunes will modify it, because that is data that is stored inside the file. And when you create a file (like then you rip a CD) the date created and modified are the same by any reasonable logic.

I'd like to better fully understand miles' Terminal instructions first, since I'm not familiar with Terminal. So for now, you don't need to figure out a solution. I don't wanna waste your time. Thank you though.

I think if you google 'folder actions mac os x' you may find what you're looking for. And it's no problem, always glad to help out :)
 
Although I don't know why you would want to manually manage files, iTunes does a spectacular job (I guess as long as it's on your main drive).

When I was on Windows not too long ago, I always used WinAmp and never used it's Library feature (like most, it seemed). I organized my music folders into a particular file structure, so when I switched to Mac, I decided to keep it. From what I could tell, iTunes' sorting method would do away with most of the conveniences I'm used to with my folder system. Conveniences that could only be maintained if my files were perfectly tagged, but many of them aren't as I didn't bother with it when using WinAmp. When I eventually get to finding the best program to fix the metadata in my collection, I might try iTunes' sorting method. But my collection is huge. I don't know if I'll have the energy to tag every single file properly.

Type "touch " (with the space) and then drag your file into the terminal window, then...

Thank you so much for that explanation. Now that I understand it, I can see that while it could help with future file additions to my folder, it, a) cannot be applied to pre-existing files in my folder since it would simply change all their dates to today's date and, b) it would involve always having to open up Terminal to put in that command every time I put in a new file.

When you change anything inside the file.

Got it! Thanks.

I think if you google 'folder actions mac os x' you may find what you're looking for. And it's no problem, always glad to help out :)

I don't know how I overlooked the "Folder Actions Setup" feature in the contextual window when I've been so meticulous in trying to learn and use all the obvious and little things in Finder. Googled it. Looks incredibly useful. Though the predefined scripts are very limited. So maybe I'll learn a bit about scripts so I can make use of this. The Apple Script Editor looks very daunting though.

I recently helped someone with a similar question. There is also an example of a folder action for changing the modified date.

https://forums.macrumors.com/threads/918575/

Wow, looks like it should do what I need. Admittedly, I'm not entirely comfortable just typing out your script in the screenshot, since I've never worked with scripts before, but I'll keep it mind if I acquire some basic script knowledge. Thanks.
 
I know this is old, but I read this thread as I was searching for something else.

The best (IMO) solution to this issue is to use the "m" and "t" flags with the touch command in terminal. You can then change the Modified date to any date and time you'd like. Really helpful in certain circumstances. The command in Terminal would look like this:

touch -mt YYYYMMDDHHMM PATH_TO_FILE_HERE

YYYY is the year in 4 digits
MM is the month in 2 digits
DD is the day in 2 digits
HH is the hour (in 24 hour format) in 2 digits
MM is the minutes in 2 digits

So.. If I want to change the last modified date to July 4th 2009 at 1:35pm for a file named MacRumors.txt that is in my Documents folder, the command in Terminal would look like this:

touch -mt 200907041335 ~/Documents/MacRumors.txt

I hope this helps someone ;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.