B
bulldog8
I've read numerous posts and have tried multiple approaches that I
found, but just cannot get a file renamed. I am using VB.Net 2002 ...
Here is what I have tried:
1) Code common to all attempts:
OldName = "c:\albums\061203\email\DSC07272.JPG"
NewName = "c:\albums\061203\email\Lalala.JPG"
sNewFileCheck = Dir(NewName)
If sNewFileCheck = "" Then
... followed by the below
a) ReName(OldFile, NewFile)
Error 53 : File not found
I am assuming it cannot find the old file here ...
b) System.IO.File.Move
Error 57
"The process cannot access the file
"c:\albums\061203\email\Lalala.JPG" because it is being used by another
process."
- Very confusing, since Lalala.jpg did not exist prior
to the Move call
c) System.IO.File.Copy(OldFile, NewFile) works,
Kill(OldFile) fails with
Error 55
"The process cannot access the file
"c:\albums\061203\email\DSC07272.JPG" because it is being used by
another process."
- Confusing also, since in debug I go and verify that the new file
has been created. Maybe adding a DoEvents before Kill?
I wish VB was still simple and BASIC .....
Any direction would be appreciated!
- Jon
found, but just cannot get a file renamed. I am using VB.Net 2002 ...
Here is what I have tried:
1) Code common to all attempts:
OldName = "c:\albums\061203\email\DSC07272.JPG"
NewName = "c:\albums\061203\email\Lalala.JPG"
sNewFileCheck = Dir(NewName)
If sNewFileCheck = "" Then
... followed by the below
a) ReName(OldFile, NewFile)
Error 53 : File not found
I am assuming it cannot find the old file here ...
b) System.IO.File.Move
Error 57
"The process cannot access the file
"c:\albums\061203\email\Lalala.JPG" because it is being used by another
process."
- Very confusing, since Lalala.jpg did not exist prior
to the Move call
c) System.IO.File.Copy(OldFile, NewFile) works,
Kill(OldFile) fails with
Error 55
"The process cannot access the file
"c:\albums\061203\email\DSC07272.JPG" because it is being used by
another process."
- Confusing also, since in debug I go and verify that the new file
has been created. Maybe adding a DoEvents before Kill?
I wish VB was still simple and BASIC .....
Any direction would be appreciated!
- Jon