• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Searching for a folder in Applescript.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching for a folder in Applescript.


  • Subject: Re: Searching for a folder in Applescript.
  • From: Michael Grant <email@hidden>
  • Date: Thu, 04 Sep 2003 22:36:05 -0500

On 9/4/03 11:33 AM, "Vic Piercy" <email@hidden> wrote:

> I need to write a script that will be placed in the Login items that runs
> every time a user logs in. It will create a folder with the current date in
> the users Home folder. I have the script ready but I cant figure out how to
> have it check for the folder in case of a reboot in the same day the script
> will say 3There is a folder by that name already please choose a new name2.
> In a nutshell, I need it to check for the folder first if it is there then
> the script will end. If it is not there then it will create a new folder
> with the current date. So each day when I log in it will automatically
> create a today's date folder in the Home folder.

I think this is roughly what you're looking for:


-- First write code to set variables:

-- myContainer to store the HFS path to your destination folder
-- (including the trailing colon)

-- myFolderName to store the new folder name based on today's date.
-- (Personally I prefer YYMMDD format because it sorts neatly.)

-- Then:

set myFolderPath to myContainer & myFolderName
tell application "Finder"
if (exists of item myFolderPath) then
return
else
make new folder at myContainer with properties {name:myFolderName}
end if
end tell


Michael

--
"I promise you that I will listen to what has been said here, even though I
wasn't here."

- George W. Bush at the President's Economic Forum, Waco, TX, Aug. 13, 2002
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Searching for a folder in Applescript. (From: Vic Piercy <email@hidden>)

  • Prev by Date: curl script result
  • Next by Date: Re: curl script result
  • Previous by thread: Re: Searching for a folder in Applescript.
  • Next by thread: Re: Searching for a folder in Applescript.
  • Index(es):
    • Date
    • Thread