« [JOSN]気象庁の天気予報(JSONObjectWithData変換) | トップページ | [メモ]気象庁の天気予報JSON »

[FInder]フォルダの中身を複製(duplicate)

ダウンロード - dropboxe38395e382a9e383abe382bfe38299e381abe382b3e38392e3829ae383bc.scpt.zip


#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSURL : a reference to objMe's NSURL

set objFileManager to objMe's NSFileManager's defaultManager()

#####
set ocidNSURLIsAliasFileKey to objMe's NSURLIsAliasFileKey

##########################################
###移動元フォルダ
tell application "Finder"
set aliasScriptsFolder to (path to scripts folder from user domain) as alias
end tell
###パス
set strDirPath to POSIX path of aliasScriptsFolder as text
###NSStringテキスト
set ocidDirPath to (objNSString's stringWithString:strDirPath)
#####NSURL NSStringURL
set ocidUrlPath to (objNSURL's fileURLWithPath:ocidDirPath)

##########################################
####移動先フォルダ
tell application "Finder"
set aliasHomeFolder to (path to home folder from user domain)
set aliasDropbox to folder "Scripts" of folder "Dropbox" of folder aliasHomeFolder as alias
end tell

###フォルダの内容をリストで取得
set ocidContentsArray to (objFileManager's contentsOfDirectoryAtURL:ocidUrlPath includingPropertiesForKeys:{ocidNSURLIsAliasFileKey} options:(4) |error|:(missing value))

###取得したURLリスト=フォルダの第一階層のリストの数だけ繰り返し
repeat with ocidContents in ocidContentsArray
set aliasFile to ocidContents as alias
log aliasFile
try
tell application "Finder"
##移動
##move aliasFile to aliasDistDir
##複製(コピー)
duplicate aliasFile to aliasDropbox with replacing and exact copy
end tell
end try
end repeat

|

« [JOSN]気象庁の天気予報(JSONObjectWithData変換) | トップページ | [メモ]気象庁の天気予報JSON »

AppleScript Folder」カテゴリの記事