Move and Copy
The Move refactorings allow you to move files, directories, class members and declarations within a project. In doing so, CLion tracks these movements and automatically corrects all references to the moved symbols in the source code.
The following Move refactorings are available:
The Move File refactoring moves a file to another directory.
The Move Directory refactoring moves a directory to another directory.
The Move Member refactoring moves the selected class member to a new or an existing class.
The Move Declaration refactoring moves the top level type declaration to a new or an existing file.
Move a file or directory to another directory
Select the file or directory in the Project tool window.
- Do one of the following:
From the main menu, choose
.From the context menu of the selection, choose
.Press F6.
The dialog that opens depends on the type of the selected symbol.
In the To directory field, specify the folder to move the selected file or folder to. Choose an existing folder from the list or type the full path to the parent folder to be created.
To have the references to the selected file or folder updated according to the refactoring result, select the Search for references checkbox.
Move class members to another class, existing or new
In the Editor or Structure view, select the class member to be moved.
-
Do one of the following:
From the main menu, choose
.From the context menu of the selection, choose
.Press F6.
The dialog that opens depends on the type of the selected symbol.
Type the destination class name or click the button to choose.
Select the class members to be moved to the specified class.
Move declarations to another file, existing or new
In the editor or Structure view, select the declaration to be moved to another file.
-
Do one of the following:
From the main menu, choose
.From the context menu of the selection, choose
.Press F6
The dialog that opens depends on the type of the selected symbol.
Type the destination filename or click the button to choose.
Select the declaration to be moved to another file.
Copy refactoring
The Copy refactoring allows you to copy a class, file, or directory with its entire structure from one directory to another.
To copy a class, file, or directory
Select the desired item in one of the views or open it in the editor.
-
Do one of the following:
From the main menu or the selection context menu, choose
.Press F5.
Select the desired class in the Project tool window and drag it to the target destination with Ctrl pressed.
In the Copy dialog that opens specify the new name and destination, then click OK.