|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hello Here is a script I uses from time to time: --[SCRIPT] set sourceFile to choose file set destFolder to choose folder tell application "Finder" set origName to name of sourceFile if not (exists file ((destFolder as text) & origName)) then duplicate sourceFile to destFolder else set tempFolder to (path to "temp" from user domain) as alias set tempFile to duplicate sourceFile to tempFolder set unique to my buildUniqueName(destFolder, sourceFile) set name of tempFile to unique move file ("" & tempFolder & unique) to destFolder end if end tell -- ========== on buildUniqueName(df, sf) local n1, xn, begName, n, n2, newPath tell application "Finder" set n1 to name of sf try set xn to "." & (name extension of sf) set begName to text 1 thru (-1 - (length of xn)) of n1 on error set {xn, begName} to {"", n1} end try set n to 1 repeat set n2 to ¬ begName & (text -4 thru -1 of ("0000" & n)) & xn set newPath to "" & df & n2 if exists file newPath then set n to n + 1 else exit repeat end if end repeat end tell -- to Finder return n2 end buildUniqueName -- ========== --[/SCRIPT] Yvan KOENIG |
_______________________________________________ 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
| References: | |
| >Re: duplicate (From: Yvan KOENIG <email@hidden>) | |
| >Rép: duplicate (From: Yvan KOENIG <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.