Home All Groups Group Topic Archive Search About

Open folders to process files automatically

Author
3 Oct 2006 7:10 PM
jonathandrott
sorry newbie question probably.  i'm trying to open an specific folder.
open each file with in the folder individually and process each one.
all the processing code has been written.  i'm looking for sample code
to open the folder and start grabbing files.  thanks.

Author
3 Oct 2006 7:29 PM
Miro
Written in notepad...but it should be pretty close to what your looking for.
Goes and gets all the available folders in a folder...
then loops thru em and gets all the files per.
=====
Dim AllFolders() As String = Directory.GetDirectories("datadir")
Dim AvailableFiles() As String
Dim ArrayNum as Integer = 0

'go thru each subfolder and look for files
        For ArrayNum = 0 To UBound(AllFolders)
            AvailableFiles = _
                Directory.GetFiles( AllFolders(ArrayNum), "*.txt")

            'check here and loop again to add those files to some other
arraylist or something
        Next

=====

Miro



<jonathandr***@gmail.com> wrote in message
Show quoteHide quote
news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
> sorry newbie question probably.  i'm trying to open an specific folder.
> open each file with in the folder individually and process each one.
> all the processing code has been written.  i'm looking for sample code
> to open the folder and start grabbing files.  thanks.
>
Author
3 Oct 2006 8:20 PM
jonathandrott
still not quite understanding this.  i want to open a known folder
(i.e. "C:\ToProcess").  inside ToProcess is about 8-10 files, each
having a different name.  so, i want to check  if the files are there.
then, process the files with some code i have already written.  right
now i'm set up to browse to the file and click a seperate process
button.

Program:  open program, press process button, and files process one by
one.
Miro wrote:
Show quoteHide quote
> Written in notepad...but it should be pretty close to what your looking for.
> Goes and gets all the available folders in a folder...
> then loops thru em and gets all the files per.
> =====
> Dim AllFolders() As String = Directory.GetDirectories("datadir")
> Dim AvailableFiles() As String
> Dim ArrayNum as Integer = 0
>
>  'go thru each subfolder and look for files
>         For ArrayNum = 0 To UBound(AllFolders)
>             AvailableFiles = _
>                 Directory.GetFiles( AllFolders(ArrayNum), "*.txt")
>
>             'check here and loop again to add those files to some other
> arraylist or something
>         Next
>
> =====
>
> Miro
>
>
>
> <jonathandr***@gmail.com> wrote in message
> news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
> > sorry newbie question probably.  i'm trying to open an specific folder.
> > open each file with in the folder individually and process each one.
> > all the processing code has been written.  i'm looking for sample code
> > to open the folder and start grabbing files.  thanks.
> >
Author
3 Oct 2006 8:32 PM
Izzy
You'll need to be more specific about "I want to process the file".
Move it, Copy it, Read it, Modify it, Delete it.

The code above will get you a list of files, you just need to modify
the search string.

Once you have a list of files, check out System.IO.FileInfo OR
System.IO.File

I would post code too help you out, but specifics are needed.

Izzy


jonathandr***@gmail.com wrote:
Show quoteHide quote
> still not quite understanding this.  i want to open a known folder
> (i.e. "C:\ToProcess").  inside ToProcess is about 8-10 files, each
> having a different name.  so, i want to check  if the files are there.
> then, process the files with some code i have already written.  right
> now i'm set up to browse to the file and click a seperate process
> button.
>
> Program:  open program, press process button, and files process one by
> one.
> Miro wrote:
> > Written in notepad...but it should be pretty close to what your looking for.
> > Goes and gets all the available folders in a folder...
> > then loops thru em and gets all the files per.
> > =====
> > Dim AllFolders() As String = Directory.GetDirectories("datadir")
> > Dim AvailableFiles() As String
> > Dim ArrayNum as Integer = 0
> >
> >  'go thru each subfolder and look for files
> >         For ArrayNum = 0 To UBound(AllFolders)
> >             AvailableFiles = _
> >                 Directory.GetFiles( AllFolders(ArrayNum), "*.txt")
> >
> >             'check here and loop again to add those files to some other
> > arraylist or something
> >         Next
> >
> > =====
> >
> > Miro
> >
> >
> >
> > <jonathandr***@gmail.com> wrote in message
> > news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
> > > sorry newbie question probably.  i'm trying to open an specific folder.
> > > open each file with in the folder individually and process each one.
> > > all the processing code has been written.  i'm looking for sample code
> > > to open the folder and start grabbing files.  thanks.
> > >
Author
3 Oct 2006 8:43 PM
jonathandrott
never had to do this before... i don't understand how the array stores
the names of the files or how to call them back in my code so that i
can loop through.

"I want to process" =
i have a section of code that already is written to process the file.
(it opens it, reads it, moves it, then deletes it.)  i want to do it
with a click of a button, instead of using file browser to select a
file, using a btn command to process the file, and selecting file
browse to select another file.

i'll be happy to email code.
Izzy wrote:
Show quoteHide quote
> You'll need to be more specific about "I want to process the file".
> Move it, Copy it, Read it, Modify it, Delete it.
>
> The code above will get you a list of files, you just need to modify
> the search string.
>
> Once you have a list of files, check out System.IO.FileInfo OR
> System.IO.File
>
> I would post code too help you out, but specifics are needed.
>
> Izzy
>
>
> jonathandr***@gmail.com wrote:
> > still not quite understanding this.  i want to open a known folder
> > (i.e. "C:\ToProcess").  inside ToProcess is about 8-10 files, each
> > having a different name.  so, i want to check  if the files are there.
> > then, process the files with some code i have already written.  right
> > now i'm set up to browse to the file and click a seperate process
> > button.
> >
> > Program:  open program, press process button, and files process one by
> > one.
> > Miro wrote:
> > > Written in notepad...but it should be pretty close to what your looking for.
> > > Goes and gets all the available folders in a folder...
> > > then loops thru em and gets all the files per.
> > > =====
> > > Dim AllFolders() As String = Directory.GetDirectories("datadir")
> > > Dim AvailableFiles() As String
> > > Dim ArrayNum as Integer = 0
> > >
> > >  'go thru each subfolder and look for files
> > >         For ArrayNum = 0 To UBound(AllFolders)
> > >             AvailableFiles = _
> > >                 Directory.GetFiles( AllFolders(ArrayNum), "*.txt")
> > >
> > >             'check here and loop again to add those files to some other
> > > arraylist or something
> > >         Next
> > >
> > > =====
> > >
> > > Miro
> > >
> > >
> > >
> > > <jonathandr***@gmail.com> wrote in message
> > > news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
> > > > sorry newbie question probably.  i'm trying to open an specific folder.
> > > > open each file with in the folder individually and process each one.
> > > > all the processing code has been written.  i'm looking for sample code
> > > > to open the folder and start grabbing files.  thanks.
> > > >
Author
3 Oct 2006 8:50 PM
Izzy
Sure send me the code. I'll write it and send it back with comments so
you'll understand what's happening.

Send the project to irich***@houston.rr.com along with a sample file.

Izzy


jonathandr***@gmail.com wrote:
Show quoteHide quote
> never had to do this before... i don't understand how the array stores
> the names of the files or how to call them back in my code so that i
> can loop through.
>
> "I want to process" =
> i have a section of code that already is written to process the file.
> (it opens it, reads it, moves it, then deletes it.)  i want to do it
> with a click of a button, instead of using file browser to select a
> file, using a btn command to process the file, and selecting file
> browse to select another file.
>
> i'll be happy to email code.
> Izzy wrote:
> > You'll need to be more specific about "I want to process the file".
> > Move it, Copy it, Read it, Modify it, Delete it.
> >
> > The code above will get you a list of files, you just need to modify
> > the search string.
> >
> > Once you have a list of files, check out System.IO.FileInfo OR
> > System.IO.File
> >
> > I would post code too help you out, but specifics are needed.
> >
> > Izzy
> >
> >
> > jonathandr***@gmail.com wrote:
> > > still not quite understanding this.  i want to open a known folder
> > > (i.e. "C:\ToProcess").  inside ToProcess is about 8-10 files, each
> > > having a different name.  so, i want to check  if the files are there.
> > > then, process the files with some code i have already written.  right
> > > now i'm set up to browse to the file and click a seperate process
> > > button.
> > >
> > > Program:  open program, press process button, and files process one by
> > > one.
> > > Miro wrote:
> > > > Written in notepad...but it should be pretty close to what your looking for.
> > > > Goes and gets all the available folders in a folder...
> > > > then loops thru em and gets all the files per.
> > > > =====
> > > > Dim AllFolders() As String = Directory.GetDirectories("datadir")
> > > > Dim AvailableFiles() As String
> > > > Dim ArrayNum as Integer = 0
> > > >
> > > >  'go thru each subfolder and look for files
> > > >         For ArrayNum = 0 To UBound(AllFolders)
> > > >             AvailableFiles = _
> > > >                 Directory.GetFiles( AllFolders(ArrayNum), "*.txt")
> > > >
> > > >             'check here and loop again to add those files to some other
> > > > arraylist or something
> > > >         Next
> > > >
> > > > =====
> > > >
> > > > Miro
> > > >
> > > >
> > > >
> > > > <jonathandr***@gmail.com> wrote in message
> > > > news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
> > > > > sorry newbie question probably.  i'm trying to open an specific folder.
> > > > > open each file with in the folder individually and process each one.
> > > > > all the processing code has been written.  i'm looking for sample code
> > > > > to open the folder and start grabbing files.  thanks.
> > > > >
Author
3 Oct 2006 9:10 PM
Miro
John, try this... ( in the mean time while izzy is looking at ur code )

Plop that code I gave you into ur program,
then put a Debug.Writeline( "put stop here" )
in the comment part i put.

Put a code stopper red dot in left hand side on it.

When the code stops here... go to the debuger and look what is in the array,
in the locals/ watch .

It took me a while when i first started ( about 1.5 months ago ) how to view
data in the debugger... it opend up a whole new world for me at the time.  I
was in the same boat you were.  - and probably still am for most things ;)

Miro



Show quoteHide quote
"Izzy" <israel.rich***@gmail.com> wrote in message
news:1159908656.083557.163250@i42g2000cwa.googlegroups.com...
> Sure send me the code. I'll write it and send it back with comments so
> you'll understand what's happening.
>
> Send the project to irich***@houston.rr.com along with a sample file.
>
> Izzy
>
>
> jonathandr***@gmail.com wrote:
>> never had to do this before... i don't understand how the array stores
>> the names of the files or how to call them back in my code so that i
>> can loop through.
>>
>> "I want to process" =
>> i have a section of code that already is written to process the file.
>> (it opens it, reads it, moves it, then deletes it.)  i want to do it
>> with a click of a button, instead of using file browser to select a
>> file, using a btn command to process the file, and selecting file
>> browse to select another file.
>>
>> i'll be happy to email code.
>> Izzy wrote:
>> > You'll need to be more specific about "I want to process the file".
>> > Move it, Copy it, Read it, Modify it, Delete it.
>> >
>> > The code above will get you a list of files, you just need to modify
>> > the search string.
>> >
>> > Once you have a list of files, check out System.IO.FileInfo OR
>> > System.IO.File
>> >
>> > I would post code too help you out, but specifics are needed.
>> >
>> > Izzy
>> >
>> >
>> > jonathandr***@gmail.com wrote:
>> > > still not quite understanding this.  i want to open a known folder
>> > > (i.e. "C:\ToProcess").  inside ToProcess is about 8-10 files, each
>> > > having a different name.  so, i want to check  if the files are
>> > > there.
>> > > then, process the files with some code i have already written.  right
>> > > now i'm set up to browse to the file and click a seperate process
>> > > button.
>> > >
>> > > Program:  open program, press process button, and files process one
>> > > by
>> > > one.
>> > > Miro wrote:
>> > > > Written in notepad...but it should be pretty close to what your
>> > > > looking for.
>> > > > Goes and gets all the available folders in a folder...
>> > > > then loops thru em and gets all the files per.
>> > > > =====
>> > > > Dim AllFolders() As String = Directory.GetDirectories("datadir")
>> > > > Dim AvailableFiles() As String
>> > > > Dim ArrayNum as Integer = 0
>> > > >
>> > > >  'go thru each subfolder and look for files
>> > > >         For ArrayNum = 0 To UBound(AllFolders)
>> > > >             AvailableFiles = _
>> > > >                 Directory.GetFiles( AllFolders(ArrayNum), "*.txt")
>> > > >
>> > > >             'check here and loop again to add those files to some
>> > > > other
>> > > > arraylist or something
>> > > >         Next
>> > > >
>> > > > =====
>> > > >
>> > > > Miro
>> > > >
>> > > >
>> > > >
>> > > > <jonathandr***@gmail.com> wrote in message
>> > > > news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
>> > > > > sorry newbie question probably.  i'm trying to open an specific
>> > > > > folder.
>> > > > > open each file with in the folder individually and process each
>> > > > > one.
>> > > > > all the processing code has been written.  i'm looking for sample
>> > > > > code
>> > > > > to open the folder and start grabbing files.  thanks.
>> > > > >
>
Author
3 Oct 2006 9:21 PM
jonathandrott
thanks.  i'll try that.  that's a really good piece of advice.

Miro wrote:
Show quoteHide quote
> John, try this... ( in the mean time while izzy is looking at ur code )
>
> Plop that code I gave you into ur program,
> then put a Debug.Writeline( "put stop here" )
> in the comment part i put.
>
> Put a code stopper red dot in left hand side on it.
>
> When the code stops here... go to the debuger and look what is in the array,
> in the locals/ watch .
>
> It took me a while when i first started ( about 1.5 months ago ) how to view
> data in the debugger... it opend up a whole new world for me at the time.  I
> was in the same boat you were.  - and probably still am for most things ;)
>
> Miro
>
>
>
> "Izzy" <israel.rich***@gmail.com> wrote in message
> news:1159908656.083557.163250@i42g2000cwa.googlegroups.com...
> > Sure send me the code. I'll write it and send it back with comments so
> > you'll understand what's happening.
> >
> > Send the project to irich***@houston.rr.com along with a sample file.
> >
> > Izzy
> >
> >
> > jonathandr***@gmail.com wrote:
> >> never had to do this before... i don't understand how the array stores
> >> the names of the files or how to call them back in my code so that i
> >> can loop through.
> >>
> >> "I want to process" =
> >> i have a section of code that already is written to process the file.
> >> (it opens it, reads it, moves it, then deletes it.)  i want to do it
> >> with a click of a button, instead of using file browser to select a
> >> file, using a btn command to process the file, and selecting file
> >> browse to select another file.
> >>
> >> i'll be happy to email code.
> >> Izzy wrote:
> >> > You'll need to be more specific about "I want to process the file".
> >> > Move it, Copy it, Read it, Modify it, Delete it.
> >> >
> >> > The code above will get you a list of files, you just need to modify
> >> > the search string.
> >> >
> >> > Once you have a list of files, check out System.IO.FileInfo OR
> >> > System.IO.File
> >> >
> >> > I would post code too help you out, but specifics are needed.
> >> >
> >> > Izzy
> >> >
> >> >
> >> > jonathandr***@gmail.com wrote:
> >> > > still not quite understanding this.  i want to open a known folder
> >> > > (i.e. "C:\ToProcess").  inside ToProcess is about 8-10 files, each
> >> > > having a different name.  so, i want to check  if the files are
> >> > > there.
> >> > > then, process the files with some code i have already written.  right
> >> > > now i'm set up to browse to the file and click a seperate process
> >> > > button.
> >> > >
> >> > > Program:  open program, press process button, and files process one
> >> > > by
> >> > > one.
> >> > > Miro wrote:
> >> > > > Written in notepad...but it should be pretty close to what your
> >> > > > looking for.
> >> > > > Goes and gets all the available folders in a folder...
> >> > > > then loops thru em and gets all the files per.
> >> > > > =====
> >> > > > Dim AllFolders() As String = Directory.GetDirectories("datadir")
> >> > > > Dim AvailableFiles() As String
> >> > > > Dim ArrayNum as Integer = 0
> >> > > >
> >> > > >  'go thru each subfolder and look for files
> >> > > >         For ArrayNum = 0 To UBound(AllFolders)
> >> > > >             AvailableFiles = _
> >> > > >                 Directory.GetFiles( AllFolders(ArrayNum), "*.txt")
> >> > > >
> >> > > >             'check here and loop again to add those files to some
> >> > > > other
> >> > > > arraylist or something
> >> > > >         Next
> >> > > >
> >> > > > =====
> >> > > >
> >> > > > Miro
> >> > > >
> >> > > >
> >> > > >
> >> > > > <jonathandr***@gmail.com> wrote in message
> >> > > > news:1159902616.553462.228200@m7g2000cwm.googlegroups.com...
> >> > > > > sorry newbie question probably.  i'm trying to open an specific
> >> > > > > folder.
> >> > > > > open each file with in the folder individually and process each
> >> > > > > one.
> >> > > > > all the processing code has been written.  i'm looking for sample
> >> > > > > code
> >> > > > > to open the folder and start grabbing files.  thanks.
> >> > > > >
> >