Hi all,
I have a buggy program that chooses to save its files (audio) without a “created” or “modified” date. The files themselves work fine, but the backup program I use chooses to ignore them, since it does its work by checking these “modified” dates. If I open the audio files in another program and then save them, they backup just fine.
I’d like to be able to point to a given folder, and schedule an AppleScript to check if there’s a “modified” date for each file–and if there’s not, I’d like to change the modified date to the current time/date.
Any script that I’ve written has gone awry (and not worked at all, or just messed up the files). Can anyone give me any pointers/guidelines on how to do this? I’m still relatively new to AppleScript…
Thanks everyone,
Adam
To my everlasting shame I am not on a Mac right now.
But I would use the unix “touch” command on files who error (or return “”) for a modification date (found in the Finder’s dictionary)
I’ll help you more when I get home (if no one else has)
select a file in the finder. then tell me what the result/error of this is…
tell application "Finder"
set sel to item 1 of (get selection)
return modification date of sel
end tell
Hi there! Thanks so much for helping…
The result, according to AppleScript is:
date “Sunday, February 5, 2040 10:28:16 PM”
(…though, incidentally, the date in the List View says “Dec 31, 1903, 4:00 PM”)
It’s interesting to see the time span Apple seems to allow for Finder birth- and death-days. 
Thanks, and I’m definitely looking forward to the conclusion!
Adam
Hi MacGeek (et al)
I’m sure that you’ve clearly got more to do than sit around & ponder my problems-- but I’m wondering if you have any thoughts on solving this issue-- it seemed like you maybe had an idea, and I was wondering if you thought any more about it…
Clearly, no worries if you haven’t got the time-- it just seemed like there was a seed of an idea…
Thanks!
Adam
sorry, i have been busy but i still want to help
OK, put this in your script menu if you want to.
then select 1 folder in the finder
run the script in your editor or from the menu
tell application "Finder"
set sel to (get selection)
if (count of items in sel) is greater than 1 then error "please choose just one folder"
if kind of (item 1 of sel) is not "Folder" then error "please choose a folder"
set pp to (POSIX path of (item 1 of sel as alias))
set shelly to ("find \"" & (text items 1 thru ((count of pp) - 1) of pp) as string) & "\""
set folds to do shell script shelly
end tell
set selfind to textToList(folds, return)
tell application "Finder"
repeat with i from 1 to number of items in selfind
set this_item to item i of selfind
set curd to (current date)
set modd to modification date of file "Macintosh HD:new scripts:Title case songs.scpt"
if (year of modd) is greater than (year of curd) then
set modification date of file "Macintosh HD:new scripts:Title case songs.scpt" to curd
end if
end repeat
end tell
on textToList(theText, theSep)
set soFar to {}
set textSoFar to theText
repeat until theSep is not in textSoFar
set thePos to the offset of theSep in textSoFar
set thenewPos to thePos
if thenewPos is 1 then set thenewPos to 2
set nextBit to text 1 through (thenewPos - 1) of textSoFar
if textSoFar is not theSep then
set textSoFar to text (thePos + (count of text items in theSep)) through -1 of textSoFar
copy nextBit to the end of soFar
else
set textSoFar to ""
end if
end repeat
copy textSoFar to the end of soFar
return soFar
end textToList