S
Steve Wolfie
can anyone please tell me why this throws "DirectoryNotFoundException" it
also does not set the attributes like I am requesting.
Thanks, I am still pretty novice. I thought this would be pretty simple.....
Steve
Imports System.IO
Module Module1
Sub Main()
Dim ofile as file
Dim odir as directory
dim owriter as streamwriter
dim dirlist1 as string() = odir.getdirectories("C:\documents and
settings\user\my documents")
dim list as string
dim str as string
dim i as integer
dim chararr as string()
dim attrib as fileattributes
dim array as string()
For each list in dirlist1
array = odir.getfiles(list)
For each str in array
attrib = ofile.getattributes(str)
If attrib = 32 then ' this tells me if it is
ready for archiving
chararr = str.split("\") ' splits the
C:\dir\dir\dir\dir\filename.ext into an array
i = chararr.length - 1 'selects only
the filename from the array
ofile.copy(str, "C:\backupdir\" &
list.replace("C:\documents and settings\user\","") & "\" & charrarr(i)) '
this line throws the exception..... can't figure out why...
ofile.setattributes(str,
fileattributes.normal) ' this line does not set the attribute like i want
Else
End If
Next
Next
Console.writeline("Finished.")
console.readline()
End Sub
End Module
also does not set the attributes like I am requesting.
Thanks, I am still pretty novice. I thought this would be pretty simple.....
Steve
Imports System.IO
Module Module1
Sub Main()
Dim ofile as file
Dim odir as directory
dim owriter as streamwriter
dim dirlist1 as string() = odir.getdirectories("C:\documents and
settings\user\my documents")
dim list as string
dim str as string
dim i as integer
dim chararr as string()
dim attrib as fileattributes
dim array as string()
For each list in dirlist1
array = odir.getfiles(list)
For each str in array
attrib = ofile.getattributes(str)
If attrib = 32 then ' this tells me if it is
ready for archiving
chararr = str.split("\") ' splits the
C:\dir\dir\dir\dir\filename.ext into an array
i = chararr.length - 1 'selects only
the filename from the array
ofile.copy(str, "C:\backupdir\" &
list.replace("C:\documents and settings\user\","") & "\" & charrarr(i)) '
this line throws the exception..... can't figure out why...
ofile.setattributes(str,
fileattributes.normal) ' this line does not set the attribute like i want
Else
End If
Next
Next
Console.writeline("Finished.")
console.readline()
End Sub
End Module