Repository: vscode
Issue: Inconsistent behavior of Explorer when copying/moving file into folder with filename already present
Labels: bug,file-explorer,confirmed

Type: <b>Bug</b>

The following is all within the Explorer.

EDIT: Behavior also occurs when all extensions are disabled.

Actual Behavior:

- When **moving** a file to a different folder with that filename already present, when **using drag and drop**, I get asked whether to replace the file or not.

- When **copying** a file to a different folder with that filename already present, when **using drag and drop**, the file is placed into the new folder with a `" copy"` suffix before the file extension.

- When **moving** a file to a different folder with that filename already present, when **using Ctrl+X Ctrl+V or the context menu**, I get an error: 
```
The file(s) to paste have been deleted or moved since you copied them. Unable to move/copy '[source-file]' because target '[target-file]' already exists at destination.
```

- When **copying** a file to a different folder with that filename already present, when **using Ctrl+C Ctrl+V or the context menu**, the file is placed into the new folder with a `" copy"` suffix before the file extension.

Expected Behavior:

- The behavior of these four operations should be consistent. I'd argue that in each of the four cases I should get asked whether to replace the file or not.

Additional reasoning and comments:

- Pasting the file with a `" copy"` suffix makes sense when using copy and paste within the same folder, as I expect the file with the suffix to be identical to the file without suffix *in the same folder*. But when pasting a file from a different location, it might have completely different contents, violating this assumption. So the "suffix application" strategy should not be used in the cases listed above, where source and target folder are different.
- The error message that appears when moving a file via Ctrl+X Ctrl+V or the context menu appears to be wrong. The first sentence "The file(s) to paste have been deleted or moved since you copied them." also appears in cases where the statement is not true. It seems that it should be removed from the message, which makes much more sense without it.
- Using the (corrected, see above) error message vs asking whether to replace the file arguably is a design question, but either way it should be consistent between using drag and drop, hotkeys, and the menus.

VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Remote OS version: Linux x64 5.15.133.1-microsoft-standard-WSL2

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz (4 x 2904)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|15.84GB (3.21GB free)|
|Process Argv|--crash-reporter-id 329955ff-b83a-4a88-8acf-469af5bb152a --crash-reporter-id 329955ff-b83a-4a88-8acf-469af5bb152a|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: ubuntu-shared|
|OS|Linux x64 5.15.133.1-microsoft-standard-WSL2|
|CPUs|Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz (4 x 2903)|
|Memory (System)|7.68GB (5.14GB free)|
|VM|0%|
</details><details><summary>Extensions (41)</summary>

Extension|Author (truncated)|Version
---|---|---
lilypond-snippets|lhl|0.1.1
jupyter-keymap|ms-|1.1.2
remote-containers|ms-|0.348.0
remote-ssh|ms-|0.109.0
remote-ssh-edit|ms-|0.86.0
remote-wsl|ms-|0.86.0
vscode-remote-extensionpack|ms-|0.25.0
remote-explorer|ms-|0.4.3
remote-server|ms-|1.5.1
svg-preview|Sim|2.8.3
pdf|tom|1.2.2
markdown-collapsible|cat|0.1.0
vscode-deno|den|3.35.1
overtype|DrM|0.5.0
elm-ls-vscode|elm|2.8.0
prettier-vscode|esb|10.4.0
copilot|Git|1.175.0
copilot-chat|Git|0.13.1
vscode-test-explorer|hbe|2.21.1
lilypond-syntax|jea|0.1.1
scheme|jea|0.2.0
lilypond-formatter|lhl|0.2.3
lilypond-pdf-preview|lhl|0.2.8
lilypond-snippets|lhl|0.1.1
vslilypond|lhl|1.7.3
git-graph|mhu|1.30.0
vscode-docker|ms-|1.29.0
vscode-language-pack-de|MS-|1.87.2024031309
debugpy|ms-|2024.2.0
isort|ms-|2023.10.1
python|ms-|2024.2.1
vscode-pylance|ms-|2024.3.1
jupyter|ms-|2024.2.0
jupyter-renderers|ms-|1.0.17
vscode-jupyter-cell-tags|ms-|0.1.8
vscode-jupyter-slideshow|ms-|0.1.5
makefile-tools|ms-|0.9.10
test-adapter-converter|ms-|0.1.9
vscode-xml|red|0.26.1
elm|sbr|0.26.0
gitmoji-vscode|sea|1.2.5


</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:30992800
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfcontrol:30979541
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp2r3:30993541
dsvsc020:30976470
pythonait:30996668
jchc7451:30973076
gee8j676:30988843
dsvsc021:30996838

```

</details>

<!-- generated by issue reporter -->