• 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: Copy/Move a file in X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy/Move a file in X


  • Subject: Re: Copy/Move a file in X
  • From: Timothy Bates <email@hidden>
  • Date: Sun, 02 Dec 2001 12:32:03 +1100

On 1/12/01 7:53 AM, "Andrew Laurence" <email@hidden> wrote:

> Hi all,
>
> A painfully simple question... In Mac OS X, how do you copy/move a
> file with AppleScript? The Finder's 'move' command yields a error
> type -15267, and Jons Commands isn't ported yet.
>
> Any suggestions from the collective consciousness?

I have not been assimilated, but here is a script I use to clean up my
desktop, moving files with nonunique names into a cleanup folder

tell application "Finder"
set theFiles to (every file of folder (path to desktop folder) whose
file type is "PDF ") as alias list
repeat with aFile in theFiles
-- set aFile to aFile as alias
set destination to alias "Cortex:Users:tim:Desktop:papers:"
my uniqueName(aFile, destination)
--move aFile to folder "destination"
end repeat
end tell

on uniqueName(aFile, destination)
tell application "Finder"
set oldname to name of aFile
set n to 1
repeat while (exists file oldname of folder destination)
set oldname to "" & n & oldname
set n to n + 1
end repeat
set name of aFile to oldname
move file aFile to folder destination
end tell
end uniqueName


  • Prev by Date: Re: Run Script upon Waking? Solved!
  • Next by Date: Jon¹s Commands Reference
  • Previous by thread: Re: Calling other scripts?
  • Next by thread: Re: Copy/Move a file in X
  • Index(es):
    • Date
    • Thread