Help Needed with Treeview control

  • Thread starter Thread starter Saabster
  • Start date Start date
S

Saabster

Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS files.
These files are all named with the same pattern of call#_Serial #.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig
 
First of all, if you have an expectation that, when you post a message via
Google Groups, the message will be 'published' instantly, then please
disabuse yourself of that expectation. Messages can take some minutes to get
'published'. There is nothing more annoying than people posting messages
multiple times, and even more so when they are only a few seconds apart.

If you want the 'number' part of the filename when all the filenames conform
to that pattern, all you need to do is something like:

Dim _ss As String() = _filename.Split("#"c")
Dim _targetfolder as String = _ss(1)

The 'number' part will always be found in the 2nd element of the array
returned by the Split method.
 
Actually the double posting was a problem with the beta google groups
interface. for some reason it was hung up and when I trued to refresh
it, it posted twice. I did delete the 2nd erroneous posting as soon as
I saw it. so my apologies for that. I agree I hate seeing multiple
postings as well and usually use a new reader, but as this is a group I
spend little time in, I used Google instead.

Next Thanks for the info on parsing out the serial number. I took a
longer way since I did not know about the split method.

Once I have the target folder name how can find that in a network tree
structure that can be buried 3 levels deep and is not named the serial
number but instead is called "Serial Number 123456-456712"? So I guess
I 'm asking is how do I traverse a directory structure and find a 1
folder out of over 1000 that has my serial number in its name?

Thanks

Craig
 
Ahhhh ... Another good reason to avoid Google Groups like the plague :)

Ummm ... How about:

Dim _targetfolder As String = "Serial Number " & _ss(1)

Surely you must know the base path to where your target folders are stored.
 
I have the base path mapped as a drive letter so yes I know that, but
the problem is there are subfolders within subfolders. the actual
target folder can be up to 3 levels deeper than the base path.
Will VB.NET beable to find it without having the full path? If so how?

Thanks

Craig
 
No VB.NET will not be able to find it, but you will be able to write some
recursive code to walk the directory tree starting from the base path to
find the folder of interest.

For each folder that you inspect that is not the one you want you need to
check it's sub-folders and so on.
 
Back
Top