Wednesday, October 15, 2008 6:29 PMI have files that have a unc path with a filename entered into the comments of the file and I would like to be able to simply read the comments of a given file and if the comments contain a legit unc path then move the file to the location given.
When I run this code...
Public Sub remigrate(ByVal source As String)
Dim returnPath As String
returnPath = OrigPath(source.ToString)
If returnPath.ToString.Contains("\\") = True Then
Private Function OrigPath(ByVal file As String) As String
Dim FileProps As New DSOFile.OleDocumentProperties
Dim oSumProps As DSOFile.SummaryProperties
oSumProps = FileProps.SummaryProperties
If System.String.IsNullOrEmpty(oSumProps.Comments) = True Then
oSumProps = Nothing
FileProps = Nothing
I always get this error message.Unhandled Exception: System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Move(String sourceFileName, String destFileName)How can I get the OrigPath Function to release the lock it has on the source file?
Thursday, October 16, 2008 1:59 PMThe return statements you have in the code jump out of the function before your tidy up code;
Try this instead
- Marked As Answer by SimonR47 Friday, October 17, 2008 1:25 PM
Friday, October 17, 2008 1:25 PMThank You for your help. This did the trick.