如何将文件复制到Applescript中具有{name:";XXX-X-XXXX";foo}的文件夹中

如何将文件复制到Applescript中具有{name:";XXX-X-XXXX";foo}的文件夹中,applescript,duplicates,directory,Applescript,Duplicates,Directory,我有一个脚本,我需要写,我已经创建了一个文件夹与此脚本(如下),但不知道如何复制一个文件到创建的文件夹,因为它是如何命名的 set foo to computer name of (system info) tell application "Finder" set home_path to home as Unicode text set targetFile to (home_path & "Library:Logs:Xxxxx.log") set p to

我有一个脚本,我需要写,我已经创建了一个文件夹与此脚本(如下),但不知道如何复制一个文件到创建的文件夹,因为它是如何命名的

set foo to computer name of (system info)
tell application "Finder"
    set home_path to home as Unicode text
    set targetFile to (home_path & "Library:Logs:Xxxxx.log")
    set p to (path to desktop)
    try
    set targetPath to make new folder at p with properties **{name:"XXX-X-XXXX" & foo}**
        duplicate file targetFile to targetPath
    end try
end tell
我想我可以写这样的剧本

set foo to computer name of (system info)


    tell application "Finder"
        set p to (path to desktop)

        set home_path to home as Unicode text
        set targetFile to (home_path & "Library:Logs:Xxxxx.log")
        set p to (path to desktop)
        try
            set targetPath to p & {name:"LOGS-I-NEED" & foo}
            duplicate file targetFile to targetPath
        end try
        try
        on error the error_message number the error_number
            display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
        end try

    end tell
但是我得到了这个错误

-->错误号-1700从{alias“Macintosh HD:Users:dorianglanville:Desktop:”,“LOGS-I-NEEDDorian's MacBook”}到文件夹

我觉得我错过了一些简单的东西,但我盯着它看了太久,再也看不见了


谢谢大家

虽然有一些事情需要纠正,但错误与撇号无关

error number -1700 from {alias "Macintosh HD:Users:dorianglanville:Desktop:", "LOGS-I-NEEDDorian's MacBook"} to folder
请注意,targetPath由两项组成。你需要强迫它发短信

set foo to computer name of (system info)
set p to (path to desktop)
set targetFile to (path to library folder from user domain as text) & "Logs:Xxxxx.log"
set targetPath to p & "LOGS-I-NEED" & foo as text

try
    tell application "Finder" to duplicate file targetFile to targetPath
on error the error_message number the error_number
    display dialog "Error: " & the error_number & ". " & the error_message & return & "targetFile:" & targetFile & return & return & "targetPath:" & targetPath buttons {"OK"} default button 1
end try 

你想在
LOGS-I-needed
Dorian's MacBook
之间加一个冒号吗?是的,事实上那太好了。那能解决问题吗?我想我误解了你的意思,不,对不起,名字应该是LOGS-I-NEEDDorian's MacBook。我不能告诉你这是错的,但我不喜欢在文件/文件夹名称中加一个撇号。错误-1700似乎与麻烦的字符有关。是吗?您试图复制的文件名是什么?