# Move and copy refactorings

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

## Copy

The Copy refactoring lets you create a copy of a class, file or directory in a different or the same directory.

To perform copy refactoring:

Procedure:

1. Select an identifier that you want to refactor (for example, a class in the editor or a file in the Project tool window).

2. Select `Refactor | Copy` from the main or context menu or press `F5` (Windows), `F5` (macOS), `F5` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ Y` (macOS System Shortcuts), `F5` (XWin), `F5` (GNOME), `F5` (KDE), `F5` (Emacs), `F5` (Sublime Text), `F5` (Sublime Text (macOS)), `F5` (Visual Studio), `F5` (Visual Studio (macOS)), `F5` (TextMate), `F5` (NetBeans), `F5` (Eclipse), `F5` (Eclipse (macOS)).

3. In the Copy window, specify the name and location for your copy and click OK.

## Move

The Move refactoring lets you move a file/directory to another directory or a class/module to another file .

To move a file/directory:

Procedure:

1. Select a file/directory in the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Meta+1` (TextMate), `Ctrl+1` (NetBeans), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) .

2. Select `Refactor | Move` from the main or context menu or press `F6` (Windows), `F6` (macOS), `F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ I` (macOS System Shortcuts), `F6` (XWin), `F6` (GNOME), `F6` (KDE), `F6` (Emacs), `F6` (Sublime Text), `F6` (Sublime Text (macOS)), `Ctrl+R, O` (Visual Studio), `⌘ R, O` (Visual Studio (macOS)), `F6` (TextMate), `Ctrl+M` (NetBeans), `Alt+Shift+V` (Eclipse), `⌘ ⌥ V` (Eclipse (macOS)).

3. In the Move dialog, specify a directory where the selected file will be moved to:

![Move dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_move_file.png)

Click OK.

To move a class/module:

Procedure:

1. Place the caret at the class/module name:

![move class](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_move_class_caret.animated.gif)

2. Select `Refactor | Move` from the main or context menu or press `F6` (Windows), `F6` (macOS), `F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ I` (macOS System Shortcuts), `F6` (XWin), `F6` (GNOME), `F6` (KDE), `F6` (Emacs), `F6` (Sublime Text), `F6` (Sublime Text (macOS)), `Ctrl+R, O` (Visual Studio), `⌘ R, O` (Visual Studio (macOS)), `F6` (TextMate), `Ctrl+M` (NetBeans), `Alt+Shift+V` (Eclipse), `⌘ ⌥ V` (Eclipse (macOS)).

3. In the invoked dialog, you can specify a new class name and a file where this class will be placed

:

![Move Class dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_move_class_dialog.png)

Click Move. If necessary, click Preview to preview the potential changes.

