
Recursive Directory + file copy w/rename?
No problem ... I don't have VB4 but I'm sure this works exactly the same
way as in VB3. I'm assuming your D: drive is your CD and that the only
directories that exist on D: contain tif files, and those tif files
aren't hidden, and don't already exist in the target directory your
copying to, or that the final name of the file will actuall be a legal
file name. (I have to put all these disclaimers in here .. I was spanked
recently.) Anyway this is how it could go ...
Dim RootDir$
Dim SubDir$
Dim TifFiles$
Dim TifFilePath$
Dim TargetPath$
TargetPath = "C:\MYDIR"
RootDir = Dir$("D:\",16) '16 reads directories
If RootDir <> "" then 'directories do exist
Do Until RootDir = ""
SubDir = Dir$("D:\" & RootDir, 16)
If SubDir <> "" then
Do Until SubDir = ""
TifFilePath = "D:\" & RootDir & "\" & SubDir"
TifFiles = Dir$(TifFilePath & "\*.tif")
If TifFiles <> "" then
Do Until TifFiles = ""
FileCopy (TifFilePath & "\" & TifFiles), TargetPath
Name (TargetPath & "\" & TifFiles) AS (TargetPath & "\"
& RootDir & SubDir & TifFiles)
TifFiles = Dir$
Loop
End If
SubDir = Dir$
Loop
End If
RootDir = Dir$
Loop
End if
Know I admit I just threw this together, it's way past my bed time, and
I'm not thinking totally straight right now ... but you should get the
general idea here if it doesn't work just as it's written. For help do
just that ... look up help on DIR - DIR$.
Hope this helps ... and that'll be fifty bucks .. or at least a job
interview ;)