wwc_um
February 20th, 2000, 07:41 PM
Question:
1.aryFileName = Array("n01.dbf", "02.dbf", "n03.dbf", "n04.dbf", "n05.dbf")
The code above is define an array of 5 elements. What happen if there are 100 elements? How can I do it in a 'FOR' loop or is there any better solution?
2. How can I created a nested directory?
txtTrgPath is a text box for user to input the pathname
Dim inBackPos As Integer, inForePos As Integer
Dim path
inBackPos = 3
ChDrive txtTrgPath 'Change to current drive
ChDir "\" 'Change to current directory
inForePos = InStr(4, txtTrgPath, "\")
Do While inForePos <> 0
path = Mid(txtTrgPath, inBackPos + 1, inForePos - inBackPos - 1)
MkDir path
ChDir path
inBackPos = inForePos
inForePos = InStr(inBackPos + 1, txtTrgPath, "\")
Loop
The code above is correct if the directory 'Dir', 'Path' and 'Path1', let say c:\Dir\Path\Path1\ doesn't exist
What happen if the directory 'Dir' exist and the directory 'Path' and 'Path1' doesn't exist? How can I correct the problem?
Thanks
Andy
1.aryFileName = Array("n01.dbf", "02.dbf", "n03.dbf", "n04.dbf", "n05.dbf")
The code above is define an array of 5 elements. What happen if there are 100 elements? How can I do it in a 'FOR' loop or is there any better solution?
2. How can I created a nested directory?
txtTrgPath is a text box for user to input the pathname
Dim inBackPos As Integer, inForePos As Integer
Dim path
inBackPos = 3
ChDrive txtTrgPath 'Change to current drive
ChDir "\" 'Change to current directory
inForePos = InStr(4, txtTrgPath, "\")
Do While inForePos <> 0
path = Mid(txtTrgPath, inBackPos + 1, inForePos - inBackPos - 1)
MkDir path
ChDir path
inBackPos = inForePos
inForePos = InStr(inBackPos + 1, txtTrgPath, "\")
Loop
The code above is correct if the directory 'Dir', 'Path' and 'Path1', let say c:\Dir\Path\Path1\ doesn't exist
What happen if the directory 'Dir' exist and the directory 'Path' and 'Path1' doesn't exist? How can I correct the problem?
Thanks
Andy