Repository: yt-dlp
Issue: Can't update yt-dlp executable if it's on SMB network share. ERROR: Unable to move current version
Labels: enhancement,triage

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm requesting a feature unrelated to a specific site
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

I've got the yt-dlp Windows executable located on a SMB network share (Samba server). I'm not able to update the executable with the -U flag, since the file is locked for renaming while it's executed. This might be a peculiarity of the SMB protocol or especially the Samba server. `os.rename()` works when applied while the executable is not running, but it can not rename itself. This is a feature request to add a workaround for this scenario. E.g. use a helper executable/script to rename yt-dlp. This special way of updating could be triggered by an additional update flag.
For the moment I've just moved the yt-dlp executable to my local drive where the update process works flawlessly.
(Since this is quite specific to SMB or Samba I've categorized it as a Feature Request rather than Bug report)
I look forward to hearing your thoughts.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.08.01 from yt-dlp/yt-dlp [ffd7781d6] (win_exe)
[debug] Python 3.11.2 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1s  1 Nov 2022)
[debug] exe versions: ffmpeg 5.1.2-full_build-www.gyan.dev (setts), ffprobe 5.1.2-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, mutagen-1.47.0, requests-2.32.3, sqlite3-3.39.4, urllib3-2.2.2, websockets-13.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1830 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
[debug] Downloading _update_spec from https://github.com/yt-dlp/yt-dlp/releases/latest/download/_update_spec
[debug] Downloading SHA2-256SUMS from https://github.com/yt-dlp/yt-dlp/releases/download/2024.08.06/SHA2-256SUMS
Current version: stable@2024.08.01 from yt-dlp/yt-dlp
Latest version: stable@2024.08.06 from yt-dlp/yt-dlp
Current Build Hash: c11f40c0ca95056e6ec427a89b73e9f585a13ce2b51581bb37226c71f051e135
Updating to stable@2024.08.06 from yt-dlp/yt-dlp ...
[debug] Downloading yt-dlp.exe from https://github.com/yt-dlp/yt-dlp/releases/download/2024.08.06/yt-dlp.exe
ERROR: Unable to move current version
Traceback (most recent call last):
  File "yt_dlp\update.py", line 495, in update
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '\\\\10.0.0.2\\Tools\\yt-dlp\\dist\\yt-dlp.exe' -> '\\\\10.0.0.2\\Tools\\yt-dlp\\dist\\yt-dlp.exe.old'
```