Macでファイルの名前を一括変更する6つの方法

一度に多数のファイルの名前を変更するのは難しい場合があります。幸いなことに、MacBook には Automator や AppleScript などの組み込みツールがあり、複数のファイルの名前を一括で簡単に変更できます。または、サードパーティのアプリをダウンロードして、Mac でファイルの名前を一括変更することもできます。このガイドでは、両方のオプションについて説明します。
1.ファインダーを使う
Finder を使用して 、Mac でファイルの名前をバッチで変更できます。このメソッドは、完全なファイル名ではなく、プレフィックス/サフィックスのみを追加することに注意してください。ただし、バッチで単語を置き換えたり、形式を変更したりするなど、まだ多くのことができます。以下の手順に従って、Finder を使用してファイル名を変更します。
- Finder 内で名前を変更するファイルを見つけます。

- 名前を変更するすべてのファイルを選択します。

- Finder ウィンドウの右上にある 3 つのドットをクリックします。ドロップダウンメニューから「名前の変更」を選択します。
![右上の 3 つのドットをクリックし、ドロップダウン メニューから [名前の変更] を選択します。 右上の 3 つのドットをクリックし、ドロップダウン メニューから [名前の変更] を選択します。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-three-dots-in-the-top-right-and-select-rename-from-the-drop-down-menu.webp)
- ポップアップの「テキストを置換」ドロップダウンメニューをクリックします。
![[テキストの置換] ドロップダウン メニューをクリックします。 [テキストの置換] ドロップダウン メニューをクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-the-replace-text-drop-down-menu.webp)
- ドロップダウンメニューから「テキストを追加」を選択します。ファイル名を置き換える単語または文字を入力し、隣接するドロップダウン メニューで現在の名前の前または後に挿入するかどうかを選択します。
![[テキストを追加] を選択して、ファイル名を置き換える単語を入力し、名前の前後を選択します [テキストを追加] を選択して、ファイル名を置き換える単語を入力し、名前の前後を選択します](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/choose-add-text-type-the-words-to-replace-the-file-names-and-select-before-or-after-name.webp)
- 「名前の変更」をクリックして、ファイル名を変更します。
![[名前の変更] を選択してファイル名を変更する 1 [名前の変更] を選択してファイル名を変更する 1](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/select-rename-to-change-file-names-1.webp)
2. Automator の使用
Automator は、反復的なタスクを自動化するために設計された macOS の組み込みアプリです。このアプリを使用すると、ファイル名のバッチ変更など、同様のタスクをバッチにまとめることができますが、Automator ライブラリには他にも何百もの Mac オプションから選択できます。一括名前変更オプションを使用するには、以下の手順に従います。
- Finder を起動し、左側のサイドバーで[アプリケーション] を選択します。

- 「Automator」を見つけてクリックします。

- 新しいウィンドウの左下にある [新しいドキュメント] をクリックします。

- ポップアップ ウィンドウで、[ワークフロー]、[選択] の順にクリックします。
![[ワークフロー] をクリックし、ポップアップ ウィンドウで [選択] を選択します [ワークフロー] をクリックし、ポップアップ ウィンドウで [選択] を選択します](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-workflow-and-select-choose-in-the-pop-up-window.webp)
- 新しいドキュメントの左側のサイドバーから[ライブラリ] を選択します。

- 「ファイルとフォルダ」をクリックして、 Automator ライブラリ内のすべてのファイルのリストにアクセスします。

- 「Get Specified Finder Items」フォルダを見つけてダブルクリックします 。または、フォルダをワークフロー ペインにドラッグ アンド ドロップします。

- 「Rename Finder Items」フォルダをダブルクリックするか、ワークフロー ペインにドラッグ アンド ドロップします。フォルダーをドラッグする場合は、「Get Specified Finder Items」 フォルダーの下にドロップします。
- Finder アイテムの名前を変更したことを警告するダイアログ ボックスが表示された場合は、[追加しない] ボタンを選択します。

- 「Get Specified Finder Items」ボックスの上にある「Options」をクリックします。

- [オプション] の下に 3 つのオプションが表示されます。「ワークフローの実行時にこのアクションを表示する」の横にあるチェックボックスをオンにします。

- 「Finder項目の名前を変更」オプションに移動し、「日付または時刻を追加」というドロップダウンメニューを選択します。
![[日付または時刻を追加] をクリックします [日付または時刻を追加] をクリックします](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-add-date-or-time.webp)
- メニューの「順次作成」をクリックします。

- 「既存のアイテム名に番号を追加」の横にある「新しい名前」オプションを見つけてチェックします。

- 「Finder項目の名前を変更」セクションの左下にある「オプション」に移動します。

- 「ワークフローの実行時にこのアクションを表示する」の横にあるチェックボックスをオンにします。
![[ワークフローの実行時にこのアクションを表示] をクリックします。 [ワークフローの実行時にこのアクションを表示] をクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-show-this-action-when-workflow-runs.webp)
- 「追加」をクリックして、 名前を変更したいファイルのバッチを追加します。
![[追加] をクリックして、名前を変更するファイル バッチを追加します。 [追加] をクリックして、名前を変更するファイル バッチを追加します。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-add-to-add-the-file-batch-you-wish-to-rename.webp)
- ファイルのバッチを選択し、[追加] をクリックします。
![ファイル バッチを選択し、[追加] をクリックします。 ファイル バッチを選択し、[追加] をクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/select-the-file-batch-and-click-add.webp)
- ファイルのバッチの名前を変更するために使用する名前を追加します。

- ネーミング設定は好みに合わせて調整できます。「例」フィールドに名前がどのように表示されるかがわかります 。

- ワークフローが完了しました。 右上隅にある「実行」ボタンを選択します。

- ダイアログボックスが開きます。「続行」をクリックします。
![表示されるダイアログ ボックスで [続行] をクリックします。 表示されるダイアログ ボックスで [続行] をクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-continue-in-the-dialog-box-that-opens.webp)
- 名前の変更設定を示す別のダイアログ ボックスが表示されます。「続行」 をクリックして続行します。
![[ファインダ項目の名前変更] ダイアログ ボックスで [続行] をクリックして続行します。 [ファインダ項目の名前変更] ダイアログ ボックスで [続行] をクリックして続行します。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-continue-to-proceed-on-the-rename-finder-items-dialog-box.webp)
- ワークフローの実行が開始され、選択したすべてのフォルダーの名前が変更されます。

3. AppleScript の使用
AppleScript は、ファイルとフォルダーの名前をバッチで変更するためのもう 1 つの便利な macOS 組み込みツールです。これは、Mac にプリインストールされている Script Editor を使用してタスクを自動化するのに役立つスクリプト言語です。使用するには、次の手順に従います。
- 「アプリケーション -> ユーティリティ フォルダ」に移動し、「スクリプト エディタ」を起動します。

- 「ファイル」を選択し、「新規ドキュメント」オプションをクリックして新しいスクリプトを作成します。
![[ファイル] をクリックし、[新規] を選択して新しいスクリプトを作成します [ファイル] をクリックし、[新規] を選択して新しいスクリプトを作成します](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-file-and-select-new-to-create-a-new-script.webp)
- 次のコードをコピーして、[スクリプト エディター] ウィンドウに貼り付けます。
--This code is from https://gist.github.com/oliveratgithub/
settext item delimiters to"."tell application "Finder"set all_files to every item of (choosefilewithprompt"Choose the Files you’d like to rename:"with multiple selections allowed) aslist
display dialog "New file name:"default answer ""set new_name totext returned ofresult
--now we start looping through all selected files. ’index’ is our counter that we initially set to 1 and then count up with every file.--the ’index’ number is of course required for the sequential renaming of our files!
repeatwithindexfrom1to the countof all_files
--using our index, we select the appropriate file from our listset this_file to item indexof all_files
set {itemName, itemExtension} to {name, name extension} of this_file
--if the index number is lower than 10, we will add a preceding "0"for a proper filename sorting later
ifindexislessthan10then
set index_prefix to"0"elseset index_prefix to""
endif
----lets check if the current file from our list (based on index-number) has even any file-extensionif itemExtension is""then-- ""means there is no file-extension present.set file_extension to""else--yup, we are currently processing a file that has a file-extension--we have to re-add the original file-extension after changing the name of the file!set file_extension to"."& itemExtension
endif
--let’s rename our file, add the sequential number from ’index’ and add the file-extension to itset the nameof this_file to new_name & index_prefix & index & file_extension asstring
endrepeat
--congratulations for successfully accomplishing the batch renaming task:)
display alert "All done! Renamed "& index & "files with ’"& new_name & "’ for you. Have a great day!:)"end tell
- ハンマー アイコンをクリックして、スクリプトをコンパイルします。

- 上部のツールバーから「ファイル」を開き、「保存」ボタンをクリックしてスクリプトを保存します。
![[ファイル] をクリックし、[保存] を選択してスクリプトを保存します。 [ファイル] をクリックし、[保存] を選択してスクリプトを保存します。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-file-and-select-save-to-save-the-script.webp)
- [スクリプト エディタ] ウィンドウの[再生] ボタンをクリックして、スクリプトを実行します。

- 新しいウィンドウが表示され、名前を変更するファイルを選択するよう求められます。これらのファイルを含むフォルダに移動して選択し、[選択] ボタンをクリックします。
![ファイルを含むフォルダーに移動し、それらを選択して [選択] をクリックします。 ファイルを含むフォルダーに移動し、それらを選択して [選択] をクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/navigate-to-the-folder-containing-files-select-them-and-click-choose.webp)
- 別のダイアログ ボックスが表示され、ファイルの新しい名前を入力するよう求められます。新しい名前を入力し、「OK」をクリックします。
![新しい名前を入力し、[OK] をクリックします 新しい名前を入力し、[OK] をクリックします](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/enter-the-new-name-and-click-ok.webp)
- スクリプトが実行され、選択したフォルダー内のすべてのファイルの名前が新しい名前に変更されます。また、ファイルが一意であることを確認するために、ファイルには番号の接尾辞が付けられます。名前の変更が完了すると、確認メッセージが表示されます。

- スクリプト エディタ ウィンドウを閉じます。
- フォルダーをチェックして、ファイルの名前が変更されていることを確認します。

ファイル拡張子を変更する場合は、以下のコードを使用して、上記のコードをコンパイルしたのと同じ方法でスクリプト エディターでコンパイルします。
settext item delimiters to"."tell application "Finder"set all_files to every item of (choosefilewithprompt"Choose the Files you’d like to rename:"with multiple selections allowed) aslist
display dialog "New file name:"default answer ""set new_name totext returned ofresult
display dialog "New file extension:"default answer ""set new_extension totext returned ofresult
--now we start looping through all selected files. ’index’ is our counter that we initially set to 1 and then count up with every file.--the ’index’ number is of course required for the sequential renaming of our files!
repeatwithindexfrom1to the countof all_files
--using our index, we select the appropriate file from our listset this_file to item indexof all_files
set {itemName, itemExtension} to {name, name extension} of this_file
--if the index number is lower than 10, we will add a preceding "0"for a proper filename sorting later
ifindexislessthan10then
set index_prefix to"0"elseset index_prefix to""
endif
----lets check if the current file from our list (based on index-number) has even any file-extensionif new_extension is""then-- ""means there is no file-extension present.set file_extension to""else--yup, we are currently processing a file that has a file-extension--we have to re-add the original file-extension after changing the name of the file!set file_extension to"."& new_extension
endif
--let’s rename our file, add the sequential number from ’index’ and add the file-extension to itset the nameof this_file to new_name & index_prefix & index & file_extension asstring
endrepeat
--congratulations for successfully accomplishing the batch renaming task:)
display alert "All done! Renamed "& index & "files with ’"& new_name & "’ and file extension ’"& new_extension & "’ for you. Have a great day!:)"end tell
このスクリプトを実行すると、名前を変更するファイルの新しいファイル拡張子を選択する新しいオプションが表示されます。目的のファイル タイプを追加し、[OK] をクリックします。
![目的のファイル タイプを設定し、[OK] をクリックします。 目的のファイル タイプを設定し、[OK] をクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/set-your-desired-file-type-and-click-ok.webp)
ファイルの名前が変更され、ファイルの種類が指定したものに変更されたことを示す確認メッセージが表示されます。フォルダをチェックして、それを確認できます。

4.ネームチェンジャー
NameChanger は、無料でシンプルで使いやすいファイル名変更アプリです。アプリを簡単にダウンロードして、Mac 上のファイルとフォルダーの名前を一括で変更できます。これを行うには、必要なファイルをアプリにドラッグ アンド ドロップします。

ファイル名を変更するには、次のようなさまざまなオプションがあります。
- 最初のオカレンスを置換
- 最後のオカレンスを置換
- すべてのオカレンスを置換
- ワイルドカード
- 追加
- 前に追加
- 日にち
NameChanger の最も優れた点は、ファイルの名前を変更せずに行われた変更を即座に表示することです。テキスト フィールドにデータを入力したら、[名前の変更] ボタンをクリックしてファイルの名前を変更します。
NameChangerの使い方
NameChanger を使用してファイルの名前を一括変更するには、まずアプリをダウンロードして開き、次に示すようにファイルの名前変更を開始します。
- 名前を変更するファイルを選択し、アプリの左側のサイドバーにドラッグ アンド ドロップします。または、「追加」 ボタンを選択して、ファイルをアプリに追加します。
![[追加] ボタンを選択して、ファイルをアプリに追加します [追加] ボタンを選択して、ファイルをアプリに追加します](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/select-the-add-button-to-add-files-to-the-app.webp)
- ドロップダウン メニューをクリックして、さまざまな名前変更機能にアクセスします。希望するオプションを選択します。
![[最初の出現を次のものに置き換える] のドロップダウン メニューをクリックします。 [最初の出現を次のものに置き換える] のドロップダウン メニューをクリックします。](https://cdn.thewindowsclub.blog/wp-content/uploads/2023/03/click-the-dropdown-menu-of-replace-first-occurrence-with.webp)
- 選択したオプションに応じて、ポップアップ ウィンドウに複数のオプションが表示されます。たとえば、「シーケンス」オプションを使用すると、ファイル名、場所、およびファイルの配置スタイルに桁数を含めることができます。

- 「名前の変更」 ボタンをクリックして、追加したすべてのファイルの名前を変更します。

5.リネーム6
Renamer 6 は、ファイルとフォルダーの名前をすばやく変更できる別のサードパーティのファイル変更アプリです。ファイル名を変更する複数の方法を提供します。これは、選択した方法が選択したファイルまたはフォルダーに対して機能しない場合に最適な機能です。

このバッチ ファイル名変更アプリの他のユニークな機能の一部を次に示します。
- 名前変更タスクを Renamerlets に整理します
- 複雑なファイル名変更タスク用にさまざまなアセンブル チェーンを作成する機能
- 新しい名前のライブ プレビューを表示します
- データの損失を心配することなく、ファイルを元に戻したりバックアップしたりする機能
6.スマートファイルリネーム

このサードパーティのファイル名変更アプリは、複数のメディア名を変更するのに優れています。ファイルとフォルダーに加えて、Smart File Renamer は、オーディオ、写真、ファイル タグ、およびその他の多くのファイル タイプをサポートします。スマート フィルターとカスタム ルールを使用すると、データを手動で追加しなくても、ファイルの名前をすばやく変更できます。
アプリの無料版を使用できますが、無制限の名前変更は提供されないことに注意してください。無制限の名前変更機能にアクセスするには、プレミアム バージョンを購入する必要があります。
よくある質問
Automator または AppleScript を使用して、特定のフォルダー内のファイルのみの名前を変更できますか?
はい。目的のフォルダー内のファイルを選択して、Automator と AppleScript の両方で名前を変更します。
間違えた場合、名前の一括変更プロセスを元に戻すことはできますか?
はい、ほとんどのサードパーティ製アプリには元に戻す機能があります。新しい名前を間違えた場合は、すぐに元に戻し、ファイルの名前を変更し直すことができます。
ファイル名のバッチの先頭または末尾に特定のテキストまたは数字を追加するにはどうすればよいですか?
特定のテキストまたは数値フィールドに必要な文字を入力することにより、特定のテキストまたは数値をバッチの最初または最後に追加できます。組み込みアプリとサードパーティ アプリの両方に、さまざまなテキストまたは数字に固有のフィールドがあり、ファイルの名前を変更するために使用できます。
1 回の一括名前変更プロセスで、異なる拡張子のファイルの名前を変更できますか?
はい、1 つのバッチで異なる拡張子のファイルの名前を変更できます。拡張子が異なるバッチ ファイルの名前を変更する際に追加の手順は必要ないため、拡張子に関係なく、各ファイルの名前が変更されます。
Automator または AppleScript を使用して一度に名前を変更できるファイルの数に制限はありますか?
いいえ、Automator と AppleScript では、一度に名前を変更できるファイルの数に制限はありません。ただし、ワークフローまたはコードが正しく記述されていることを確認する必要があります。
サードパーティのアプリを使用して、Windows コンピューターでもファイルの名前を変更できますか?
はい、サードパーティのアプリを使用して、Windows コンピューター上のファイルの名前を変更できます。ファイルの名前を一括ですばやく変更するための多くのサードパーティ製アプリが Web 上で利用できます。一般的なアプリには、File Renamer Basic、Bulk Rename Utility、Advanced Renamer などがあります。
バッチでファイルの名前を変更する際にデータが失われるリスクはありますか?
ファイルの名前とそこに含まれるデータは、互いに独立しています。バッチ ファイルの名前を変更しても、データが失われるリスクはありません。ただし、機密情報がファイル名にエンコードされている場合、ファイルの名前を変更するとデータが失われる可能性があります。名前を変更するとファイル名が変更されるため、ファイル名に埋め込まれたデータが失われる可能性があります。
画像クレジット: Unsplash . すべてのスクリーンショットは Ojash Yadav によるものです。
- フェイスブック
- つぶやき
コメントを残す