visual-studio-code

VSCode :: How can I duplicate directories and files from within the file explorer?


Ideally, I would right-click on the folder/directory or file I want to duplicate, choose "Duplicate" and, hopefully, would be asked in the same step to give the new duplicated file or directory a new name.

Looking at the current options, I couldn't find a way to do this on latest VSCode 1.19.1 (macOS):

enter image description here

enter image description here

Am I missing something? Is there other way to do this?

The more I use VSCode, the more I get used to it and, lately, I found myself barely needing to use the terminal provided in the Panel, or switching to a terminal app, for simple stuff like this.


Solution

  • How about the good old CTRL+C and CTRL+V?

    I just tried. If you click on a file then press CTRL+C, and then CTRL+V then you get a duplicate of the file named [original name] copy.[ext]

    It's a mystery, though, why the duplicate file option is still not on the right-click menu after so many years.

    A little warning: doing this will remove the content of the clipboard. So if you are in the middle of a copy-paste cycle, then make sure to save the clipboard content somewhere. Yes, it's inconvenient, but until MS decides to put in this basic action in the context menu (right-click) we need to deal with it.