Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij: How to copy/paste a file in order to duplicate it?

I can not seem to find a way to do this? I have a file named X in some folder, I want to create Y with the same contents in the same directory. The way I do in eclipse is to select the file and ^C, ^P, eclipse prompts for the new name.

UPDATE

Apparently this problem only occurs if compilation unit contains more than one type.

like image 428
mert inan Avatar asked Jan 16 '14 21:01

mert inan


People also ask

How do you make a duplicate of a file?

Go to the location of the document you want to duplicate. Right-click the file, and click Open as copy. A new file opens and is named Copy of Document, Document 2, or similar. In the new file that opens, click the File tab, then click Save As.

How do you make a copy of a file in the same folder?

You can either right-click the file and select Copy, then right-click the folder and select Paste.... Or you can start dragging the file, hold down the shift key, the arrow cursor will get a little + on it to indicate you're making a copy, and drop it in the same folder.


2 Answers

Pressing Function key+F5 will duplicate selected file, which will prompt you to enter a name.

like image 115
Jermaine Avatar answered Oct 19 '22 19:10

Jermaine


⌥ + drag

  • Mac
    Press Option key and drag the original file.
  • PC
    Press Alt key and drag the original file.

You will be prompted for a new name.

enter image description here

Works for classes too:

enter image description here

like image 21
kukido Avatar answered Oct 19 '22 19:10

kukido