フォルダーのリネーム(エラーにならないようにする)
###デスクトップに
tell application "Finder"
set aliasDesktopDirPath to (path to desktop folder from user domain) as alias
end tell
#####フォルダ名『NewNameA』がなければ作る
tell application "Finder"
##有無を確認して
set boolExists to exists of (folder "NewNameA" of folder aliasDesktopDirPath)
if boolExists is false then
###なければ作る
make new folder at aliasDesktopDirPath with properties {name:"NewNameA"}
end if
set aliasNewFolderAPath to (folder "NewNameA" of folder aliasDesktopDirPath) as alias
end tell
#####フォルダ名『NewNameB』がなければ『NewNameA』を『NewNameB』に名前を変える
tell application "Finder"
##有無を確認して
set boolExists to exists of (folder "NewNameB" of folder aliasDesktopDirPath)
tell folder aliasNewFolderAPath
if boolExists is false then
###なければフォルダ名を変更する
set name to "NewNameB"
end if
end tell
end tell
| 固定リンク
「Folder」カテゴリの記事
- [Folder]共有用のアイコン付きフォルダ作成(アクセス権別)(2025.02.20)
- [Localised] localized名称付きのフォルダを作成する(2025.02.20)
- [Folder]修正日がX日より古いフォルダのリスト(Spotlightの方が早いけど…苦笑)(2025.01.18)
- フォルダ内のファイルの情報をHTMLで出力する 少し修正(2024.10.17)
- フォルダ内のファイルを比較 差異があるファイルにはラベルを付与(2024.07.18)
「ReName」カテゴリの記事
- [画像用リネーム]フォルダ名でリネーム(解像度サイズ入り)(2025.04.03)
- 名前+連番でリネーム(2024.08.25)
- HTMLentityバケしたファイル名をデコードして読めるファイル名にする(2024.08.04)
- ファイルの作成日 修正日でリネームする(2024.06.30)
- [ビギナー向] ファイルの移動とリネーム(2024.06.18)