.NET Framework - Problem with ShFileOperation

Asked By Sonnich Jensen on 27-Mar-12 08:23 AM
Not really C#, but

I use ShFileOperation for some operations, and found that I cannot
rename a file on a USB stick - the return code is 124, hence:

The path in the source or destination or both was invalid.

The files are:
f:\fie\99_hatluk\scrennshot.gif
to:
f:\fie\99_hatluk\screenshot.gif

and it exists.... so how come that I can check for the file existance,
but I cannot rename it from  ShFileOperation

And yes - ShFileOperation work for files on networks drives and local
drives. Just on for USB sticks

Sonnich




Arne_Vajhøj replied to Sonnich Jensen on 28-Mar-12 09:16 PM
A few questions:
* the USB stick is not write protected?
* does File Move or FileInfo MoveTo work?

Arne
Sonnich Jensen replied to Arne_Vajhøj on 05-Apr-12 02:20 AM
No


Yes
Arne_Vajhøj replied to Sonnich Jensen on 05-Apr-12 09:44 PM
Strange.

Have you tried the new IFileOperation that is supposed
to have replaced ShFileOperation from Vista and forward?

Arne
Jeff Johnson replied to Arne_Vajhøj on 06-Apr-12 12:24 PM
How exactly DO you write protect a USB stick? I have never seen a tab or
slider or anything on any of the USB sticks I have ever owned to suggest it
was even possible.
Gene Wirchenko replied to Jeff Johnson on 06-Apr-12 12:52 PM
My first one had one, but most of the ones that I have seen, do
not.

Sincerely,

Gene Wirchenko
Arne_Vajhøj replied to Jeff Johnson on 06-Apr-12 06:58 PM
Some USB sticks have a "Write protect switch".

Example:

https://www.kanguru.com/index.php/flash-drives/basic-flash/kanguru-flashblu-ii

Arne