[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: [ID 20000114.001] Perl rename function can delete files
On Fri, 14 Jan 2000 13:30:47 EST, "Moss, Jeff" wrote:
>If you use "rename" to change the case of a file name on a network
>volume the file just gets deleted.
>
>The reason is that code has been added to the "win32_rename" function in
>the file "win32.c" to use the "MoveFileEx" function when on WinNT. The
>"MoveFileEx" function is being called with the "MOVEFILE_COPY_ALLOWED"
>mask set, and that is incorrect most of the time.
>
>MOVEFILE_COPY_ALLOWED means: (quoting the MSDN documentation)
>
>"If the file is to be moved to a different volume, the function simulates
>the move by using the CopyFile and DeleteFile functions."
>
>Therefore if you're just changing the case of the file name the file
>gets copied to itself then deleted. I should note that for some reason
>this does not happen on local volumes.
>
>I will be happy to add code to only use this flag when renaming across
>volumes if you can tell me where to send it.
Thanks for the diagnosis. Diffs may be sent using perlbug to the same
address.
Sarathy
gsar@ActiveState.com
- References to:
-
"Moss, Jeff" <jmoss@huffmancorp.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]