Help. I am having a hard time with and need some experienced help. I am trying to simply move a file to another directory but can't seem to get it done.
[/SIZE]
Any guidance would help.
VB.NET:
[SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Main()[/SIZE]
[SIZE=2]Debug.WriteLine([/SIZE][SIZE=2][COLOR=#800000]"Begin dwg Strip"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] iDIR [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] tDIR [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] bDIR [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] FileName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] DelFileName [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] OldVerDir [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] OldVerFile [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] bDIRx [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] mDir [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2]bDIR = [/SIZE][SIZE=2][COLOR=#800000]"c:\test\old version"[/COLOR][/SIZE]
[SIZE=2]bDIRx = (DateTime.Now.ToString([/SIZE][SIZE=2][COLOR=#800000]"yyyyMMddHHmmss"[/COLOR][/SIZE][SIZE=2]))[/SIZE]
[SIZE=2]mDir = (bDIR & [/SIZE][SIZE=2][COLOR=#800000]" "[/COLOR][/SIZE][SIZE=2] & bDIRx)[/SIZE]
[SIZE=2]iDIR = [/SIZE][SIZE=2][COLOR=#800000]"C:\test\"[/COLOR][/SIZE]
[SIZE=2]tDIR = [/SIZE][SIZE=2][COLOR=#800000]"c:\test\common\"[/COLOR][/SIZE]
[SIZE=2]System.IO.Directory.CreateDirectory(mDir)[/SIZE]
[SIZE=2]OldVerDir = Dir(tDIR)[/SIZE]
[SIZE=2]OldVerFile = Dir(tDIR & [/SIZE][SIZE=2][COLOR=#800000]"x-*.dwg"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE][SIZE=2] OldVerFile <> [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] newnew [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE]
[SIZE=2]newnew = Dir(tDIR & [/SIZE][SIZE=2][COLOR=#800000]"x-*.dwg"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]System.Console.Write(OldVerFile)[/SIZE]
[SIZE=2]System.Console.Write(newnew)[/SIZE]
[SIZE=2]OldVerFile = tDIR & OldVerFile[/SIZE]
[SIZE=2]newnew = mDir & newnew[/SIZE]
[SIZE=2]System.IO.File.Move(OldVerFile, newnew[/SIZE][SIZE=2])[/SIZE]
[SIZE=2]OldVerFile = Dir()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE]
[SIZE=2]
Any guidance would help.
Last edited by a moderator: