• 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: Replace files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace files


  • Subject: Re: Replace files
  • From: Michelle Steiner <email@hidden>
  • Date: Sun, 12 Feb 2006 14:48:03 -0700

On Feb 12, 2006, at 2:00 PM, Jim Hankins wrote:

tell application "Finder"
if not (the folder "Old Desktop" of home exists) then
make new folder at home with properties {name:"Old Desktop"}
end if
move every file of the desktop to the folder "Old Desktop" of home
move (every folder of desktop whose class is folder) to the folder "Old
Desktop" of home
end tell

The answer is to use "with replacing".

I cleaned up the code a bit to make it somewhat less verbose. I'm not sure why you included "whose class is folder", so I left it alone. I don't know of any folder whose class is not folder, though. An application bundle's class is application file, if that's what you were concerned about.

tell application "Finder"
if not (folder "Old Desktop" of home exists) then
set oldDT to make new folder at home with properties {name:"Old Desktop"}
else
set oldDT to folder "Old Desktop" of home
end if
move files of the desktop to oldDT with replacing
move (folders of the desktop whose class is folder) to oldDT with replacing
end tell


-- Michelle

--
Velveeta is to American cheese as American cheese is to cheese.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Replace files
      • From: Jim Hankins <email@hidden>
References: 
 >Replace files (From: Jim Hankins <email@hidden>)

  • Prev by Date: Re: Validate IP Address
  • Next by Date: Re: Validate IP Address
  • Previous by thread: Replace files
  • Next by thread: Re: Replace files
  • Index(es):
    • Date
    • Thread