AppleScript 访问网络文件夹 [英] AppleScript access Network Folder

查看:39
本文介绍了AppleScript 访问网络文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将网络上的文件夹备份到我的桌面,但我不确定如何访问共享网络上的文件夹.我的代码如下:

I'm trying to make a backup of a folder on our network to my Desktop but I'm not sure how to access the folder on the shared network. My code is as follows:

on run {input, parameters}

    set desktopFolder to "Macintosh HD:Users:James:Desktop:App Backups:"
    set todayDate to do shell script "date '+%Y.%m.%d'"
    set newFolderName to "Backup " & todayDate
    set destinationFolder to desktopFolder & newFolderName
    set sourceFolder to "smb://svr01/IT_Department/Design/_team/James/App"

    tell application "Finder"
        make new folder at alias desktopFolder with properties {name:newFolderName}
        copy folder sourceFolder to folder destinationFolder
    end tell

    return input
end run

我应该使用 smb://... 地址还是 Volumes/.... 地址,我应该如何格式化它?顺便说一下,我是一个完整的 AppleScript 新手!

Should I be using the smb://... address or the Volumes/.... address, and how should I format it? I'm a complete AppleScript novice, by the way!

谢谢詹姆斯

推荐答案

copy 只复制 AppleScript 值,而不是应用程序定义的对象.使用 duplicate 命令.

copy only copies AppleScript values, not application-defined objects. Use duplicate command.

set sourceFolder to ("/Users/test/Desktop/untitled folder" as POSIX file)
set targetFolder to ("/Users/test/Desktop/untitled folder 2" as POSIX file)
tell application "Finder" to duplicate sourceFolder to targetFolder 

您可以使用 smb://... 地址.

You can use smb://... address.

这篇关于AppleScript 访问网络文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆