By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,106 Members | 2,679 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,106 IT Pros & Developers. It's quick & easy.

Open folders to process files automatically

P: n/a
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.

Oct 3 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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

<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.

Oct 3 '06 #2

P: n/a
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

<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.
Oct 3 '06 #3

P: n/a
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
jo***********@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

<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.
>
Oct 3 '06 #4

P: n/a
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
jo***********@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
>
>
>
<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.
Oct 3 '06 #5

P: n/a
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 ir******@houston.rr.com along with a sample file.

Izzy
jo***********@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
jo***********@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



<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.
>
Oct 3 '06 #6

P: n/a
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" <is************@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.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 ir******@houston.rr.com along with a sample file.

Izzy
jo***********@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
jo***********@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

<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.
>

Oct 3 '06 #7

P: n/a
thanks. i'll try that. that's a really good piece of advice.

Miro wrote:
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" <is************@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.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 ir******@houston.rr.com along with a sample file.

Izzy
jo***********@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
jo***********@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



<jo***********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.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.
>
Oct 3 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.