Store day old files in new folder

Hey everyone. You better welcome me to this forum. Because I’m brand new! I’m Peter.
And then maybe you can help me with my little apple script problem.
And yes, i am a newcomer to the AppleScript game as well, but please bear with me.

We have an upload for clients. And it can get pretty messy in there because people are just to lazy to clean it.
So I have two queries for you.

A solution for one of these would be awesome.

First one.
Every night at 23:30 i would like to create a folder in my ‘Upload’ called “YEAR-MONTH-DAY”
Then I would like to move all the files in the ‘Upload’ folder to the NewDate-folder.

Simple as that.

I managed to get todays date and create a folder with that name. But… Then what?
I figure this workflow would work? (i’m not going to write actual apple script, because it will get…ugly…)

Set todaysdate to Todays Date as string
tell finder to create folder in upload named todaysdate
move files from upload to todaysdate but exclude folders 

--> alternativly duplicate files to folder, then delete old.

But I do need some help.

Second one.
At our upload the clients gets to choose files and to who at our company they want to send the file.
The user who gets choosen in the list gets an email telling them what files got uploaded.
Now lets say the server gets that email.

“Thisfile.jpeg
Thisfile2.jpeg
got uploaded to: Mark”

Can i then with applescript get that precious mac to:
Look in upload-folder for Thisfile.jpeg And Thisfile2.jpeg then move them to Upload → Mark ?

Hi,

welcome to MacScripter

Your first question could be answered with


set uploadFolder to ((path to desktop folder as text) & "upload:")
set todaysDateFolder to uploadFolder & (do shell script "date +%y-%m-%d")
do shell script "/bin/mkdir -p " & quoted form of POSIX path of todaysDateFolder
tell application "Finder" to move files of folder uploadFolder to folder todaysDateFolder

The path to the upload folder can be a literal string path with format “Macintosh HD:path:to:upload:”
For a scheduled execution of the script use an recurrent event in iCal or a launchd agent

Your second question could be accomplished with a rule in Mail.app.
The actual code to parse the email body depends on its syntax

Great to see that i’ve made something right. Like the do shell script date-thing.
I’m going to try this out!
As i’m not a programmer i’ll have to dissect the code and try to learn from it.

I’m very thankfull for your help Stefan!