E
Emmanuel Stapf [ES]
Hi,
I'd like to implement `rename' as it is done on Unix platforms. There is
FileInfo.MoveTo, but if the destination file already exist it does not do
the renaming.
I thought of doing something like (pseudo-code):
if (destination_exists) {
delete destination
}
FileInfo.MoveTo (destination)
but this does not work when source and destination are the same file. On
unix in that case, `rename' is a no-op.
I could not find a way that is guaranteed to work accross all and future
versions of the .NET framework.
Any help appreciated,
Regards,
Manu
I'd like to implement `rename' as it is done on Unix platforms. There is
FileInfo.MoveTo, but if the destination file already exist it does not do
the renaming.
I thought of doing something like (pseudo-code):
if (destination_exists) {
delete destination
}
FileInfo.MoveTo (destination)
but this does not work when source and destination are the same file. On
unix in that case, `rename' is a no-op.
I could not find a way that is guaranteed to work accross all and future
versions of the .NET framework.
Any help appreciated,
Regards,
Manu