Drawing comparisons between what is allowed without interventions
between Windows File Explorer or cmd shell commands, etc. and
programs that you have just created are not meaningful much
of the time. The former are part of the OS itself or closely
related and are well-known to Windows and security applications.
By contrast every time you do a Build you are creating an entirely
new and unknown - and unsigned - application.
These are often subject to more rigorous scrutiny by security
software and the OS itself. For example, Windows Smartscreen
will treat your program with suspicion and UAC will signal
that it is unknown and unsigned by the colour of the UAC
dialog.
Using VS 2017, with your first test I only get the message
you posted IF the file 01.jpg has the Read-Only attribute set.
If it isn't set, the program executes as expected.
A Read-Only attribute on the source file will also be set
on the destination file. So after a copy of a Read-Only
file the source file cannot be overwritten or deleted and
the destination (interim) file cannot be deleted.
Stepping through the code and checking the directory
with File Explorer the files appear as expected after
each step.
One small addition may be helpful in cases where the
program is interrupted/aborted before completion:
'My.Computer.FileSystem.CopyFile(strPath & strFileName,
'strPath & strNewFileName)
My.Computer.FileSystem.CopyFile(strPath & strFileName,
strPath & strNewFileName, True)
This will alow overwriting the Copy-To file if it exists.
- Wayne