How to create folders for every day using the date, for example 12_04_2006 or something like this and applying custom ownership and permissions. this folder will be create in a share point on a server with mac os X 10.3, several users will create files and folders in that folder so I need to apply custon ownership and permissions for that files and folders. Is some one can help me with this, thank you very much.
Not done much of this sort of thing but this may head you off in the right direction. It could do with some more if already exists I think.
set TodaysDate to do shell script "date \"+%d-%m-%y\""
tell application "Finder"
try
set TheServer to mount volume "afp://192.168.0.248/macraid"
end try
if (not (exists folder ((TheServer as string) & "UsersName"))) then
set TheUsersFolder to make new folder at TheServer with properties {name:"UsersName"}
else
set TheUsersFolder to folder ((TheServer as string) & "UsersName")
end if
set TodaysFolder to make new folder at TheUsersFolder with properties ¬
{name:TodaysDate}
end tell
Or a pure vanilla AppleScript version using a handler found here:
set d to date_format((current date))
tell application "Finder" to make new folder at desktop with properties {name:d}
-- of course, you have to set the location of the file where you want it.
on date_format(old_date) -- modified slightly to receive a date as input
set {year:y, month:m, day:d} to old_date
tell (y * 10000 + m * 100 + d) as string to text 1 thru 4 & "." & text 5 thru 6 & "." & text 7 thru 8
end date_format
This has the advantage of putting the folder name in Finder sortable form: “2006.04.12”
Hi
This piece of code
set TodaysDate to do shell script “date "+%d-%m-%y"”
results in a date format dd.mm.yy
What has to be defind for: dd.mm.yyyy (2006)?
Thanks and regards
Lazybaer
Capitalize the “y” in the shell script format.