0

そのため、自分の仕事用のスクリプトを作成するように指示されました。目標は、コンピューター上のフォルダーを選択して、サーバーの1つにあるフォルダーにバックアップできるようにすることです。これまでのところ、サーバーをマウントし、ユーザーのユーザー名を入力として受け取り、サーバー上にそのユーザー名という名前のフォルダーを作成するためのスクリプトを取得しました。次のステップは、選択したフォルダーをサーバー上の新しいフォルダーにコピーすることです。ここで、スピードが急上昇します(ユーザーが複数のフォルダーを選択できるようにするコード行がありますが、それらを取得することはできません。その新しいフォルダにコピーします)

これが私がこれまでに持っているコードです。

display dialog "Please enter your augnet username" default answer "username"
set username to (text returned of result)

mount volume "smb://orgs.augsburg.edu"

delay 3

tell application "Finder"
    set folder backup to make new folder at folder "ORGS:Information Technology:www:kb_images:Migration Testing:" with properties {name:username}
end tell

choose folder with prompt "Please select what you would like to transfer" with multiple selections allowed
set theSelection to result

tell application "Finder" to duplicate theSelection to folder backup
4

2 に答える 2

0

次のようなシェルスクリプトを使用できます。

do shell script "cd " & theDestination & "; cp " & theSelection

これは単なる例であり、ケース、特に「目的地」の部分に適用する必要があります。基本的には、シェルスクリプトを使用してディレクトリを目的の場所に変更し、選択範囲をコピーします。コピーのオプションが必要になる場合があることに注意してください(フォルダやファイルの置換など)。

あなたはapplescriptを介してあなたにいくつかのシェルを作ったすべてを達成することができました、多分それが存在しないのでフォルダバックアップが定義されていませんか?

于 2012-05-21T19:39:28.273 に答える
0

試す:

tell application "Finder"
set backup to make new folder at folder "ORGS:Information Technology:www:kb_images:Migration Testing:" with properties {name:username}
    set theSelection to choose folder with prompt "Please select what you would like to transfer" with multiple selections allowed
    duplicate folder theSelection to backup
end tell
于 2012-05-21T19:49:17.040 に答える