2012-05-31 68 views
0

我想寫一個蘋果腳本,將兩個文件從一個文件夾複製到另一個。我嘗試了不同的方法,但不斷收到錯誤。重複的文件 - AppleScript

方法1:

tell application "Finder" 

    set home_path to home as text 

    set framework to alias (home_path & "Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework") 

    set bundle to alias (home_path & "Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework") 

    set destination to home_path & "Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty" 

    duplicate file framework to folder destination with replacing 
    duplicate file bundle to folder destination with replacing 
end tell 

方法2

tell application "Finder" 

    set framework to "Macintosh HD:Users:nayef:Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework" 

    set bundle to "Macintosh HD:Users:nayef:Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.bundle" 

    set destination to "Macintosh HD:Users:User:nayef:Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty" 

    duplicate file framework to folder destination with replacing 
    duplicate file bundle to folder destination with replacing 
end tell 

的錯誤

error "Finder got an error: Can’t set folder \"Macintosh HD:Users:User:nayef:Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty\" to file \"Macintosh HD:Users:nayef:Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework\"." number -10006 from folder "Macintosh HD:Users:User:nayef:Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty" 

這有什麼錯我的腳本?

回答

1

這是因爲 「ReaderKit.framework」 不是一個文件,使用文件夾項目別名

duplicate folder framework to folder destination with replacing 
+0

還是同樣的問題。 – darksky