rename folder to current date

hello,

I am new here and new to applescript, I have created an simple applescript to open several windows and select different folders. I also am creating one folder but what would I put in to allow to rename a folder with current date in this format mm/dd??

Thanks for your help

Model: G5 PPC dual 1.8 GHz
AppleScript: 2.1.1
Browser: Firefox 2.0.0.11
Operating System: Mac OS X (10.5)

Hi and welcome :slight_smile:

Although I won’t use slashes in file names. :wink:


set theFolder to choose folder
tell application "Finder" to set name of theFolder to do shell script "date  +%m/%d"

this what I got

But I got it to display ‘todays Date’… How can I change it to current? So I am such a newbie

tell application “Finder”
activate
select window of desktop
select window of desktop
make new Finder window to item “Network”
select Finder window 1
set position of Finder window 1 to {-1, 206}
select Finder window 1
set target of Finder window 1 to folder “FINISHED PAGES” of disk “FST Shared”
make new Finder window
select Finder window 1
set position of Finder window 1 to {436, 204}
select Finder window 1
set target of Finder window 1 to folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News”
select Finder window 1
set position of Finder window 1 to {436, 204}
select Finder window 1
make new folder at folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News” with properties {name:“untitled folder”}
set name of folder “untitled folder” of folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News” to “Today’s Date”
select Finder window 1
select Finder window 1
set target of Finder window 1 to folder “Today’s Date” of folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News”
select Finder window 1
set current view of Finder window 1 to list view
select Finder window 1
make new folder at folder “Today’s Date” of folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News” with properties {name:“untitled folder”}
set name of folder “untitled folder” of folder “Today’s Date” of folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News” to “web”
select Finder window 1
select Finder window 1
set target of Finder window 1 to folder “Tribune Finished Pages” of folder “Tribune Pages” of disk “Daily News”
select Finder window 1
set position of Finder window 1 to {436, 204}

end tell

Model: G5 PPC dual 1.8 GHz
AppleScript: 2.1.1
Browser: Firefox 2.0.0.11
Operating System: Mac OS X (10.5)

StefanK

I am so rude, sorry, and thank you for replying, and I appreciate your help. As you can see perhaps that I have script select an finder window pointing to a particular folder and I want to create another folder (directory) to be named the current date

Thanks

Chris

I’m always wondering, where these incredible stupid double lines

select window of desktop

and these completely useless make new Finder window and set target of. lines come from.
I know, it’s not your fault, but they appear occasionally here in the forum.

The bottom line of your script is

tell application "Finder"
    try
        set todayFolder to make new folder at folder "Daily News:Tribune Pages:Tribune Finished Pages:" with properties {name:do shell script "date +%m/%d"}
        make new folder at todayFolder with properties {name:"web"}
    end try
end tell

It creates the folder(s) if they don’t already exist

Thanks Stefank

It works great…

Can you treak it to include the day spelled out Display the name like “Monday 1/28” ??

that would be awesome if you can… If you can’t I understand. I know I’m asking alot!! :stuck_out_tongue:

thanks so much

Chris

this should do it:


tell application "Finder"
	try
		set todayFolder to make new folder at folder "Daily News:Tribune Pages:Tribune Finished Pages:" with properties {name:do shell script "date +%A' '%m/%d"}
		make new folder at todayFolder with properties {name:"web"}
	end try
end tell

Stefan

It worked beautifully… Thanks abunch. I will try to learn more about applescript… :cool:

How long have you dealt with scripts??

Chris

Model: G5 PPC dual 1.8 GHz
AppleScript: 2.1.1
Browser: Firefox 2.0.0.11
Operating System: Mac OS X (10.5)

I’ve started to learn AppleScript about two years ago

This works great, although now my workflow is in a different timezone, so how do I modify this to be tomorrows date? How can I add one day to this?

thanks a lot for your help

Chris