473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sequantial processing of files of several directories

Hello, i will simply state algorithm of the problem :

root "r" = GetRootDirectory( );
foreach child directory "c" of "r"
foreach file "f" of "c"
process f ;
endfor
endfor

"process" is not important here, the main problem is how i can reach a
directory, how i can visit all of its childs and catch the files of
all childs sequentially.

Regards

Aug 4 '07 #1
5 1449
kkirtac wrote:
Hello, i will simply state algorithm of the problem :

root "r" = GetRootDirectory( );
foreach child directory "c" of "r"
foreach file "f" of "c"
process f ;
endfor
endfor

"process" is not important here, the main problem is how i can reach a
directory, how i can visit all of its childs and catch the files of
all childs sequentially.

Regards
off-topic I think

I can't see anything related to C++

anyway, there's a hint
File system operation is platform specified
On Windows, check out _FindFirstFile_ on MSDN, or _File_ in Java API
Aug 4 '07 #2
"kkirtac" <ka**********@gmail.comwrote in message
news:11*********************@d55g2000hsg.googlegro ups.com...
Hello, i will simply state algorithm of the problem :

root "r" = GetRootDirectory( );
foreach child directory "c" of "r"
foreach file "f" of "c"
process f ;
endfor
endfor

"process" is not important here, the main problem is how i can reach a
directory, how i can visit all of its childs and catch the files of
all childs sequentially.
Since you gave psuedo code and haven't said what OS, etc.. I'll treat this
as an algorithm problem. Not totally OT but...

Normally I would use recursion for this.

root "r" = GetRootDirectory( );
ProcessDirectory( root );
// done

ProcessDirectory( path )
for each entry in path
if entry is file
process file
else if entry is path
ProcessDirectory( path )
endfor
Aug 4 '07 #3
On Aug 4, 12:52 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
"kkirtac" <kadir.kir...@gmail.comwrote in message

news:11*********************@d55g2000hsg.googlegro ups.com...
Hello, i will simply state algorithm of the problem :
root "r" = GetRootDirectory( );
foreach child directory "c" of "r"
foreach file "f" of "c"
process f ;
endfor
endfor
"process" is not important here, the main problem is how i can reach a
directory, how i can visit all of its childs and catch the files of
all childs sequentially.

Since you gave psuedo code and haven't said what OS, etc.. I'll treat this
as an algorithm problem. Not totally OT but...

Normally I would use recursion for this.

root "r" = GetRootDirectory( );
ProcessDirectory( root );
// done

ProcessDirectory( path )
for each entry in path
if entry is file
process file
else if entry is path
ProcessDirectory( path )
endfor
Hello, i m sorry i am on a VC++ - Win32 Console project in Visual
Studio 2005..yes i think i need recursion..i m a bit
complicated..which class to use and how..anyway, wrong place to ask
maybe, thanks

Aug 4 '07 #4
On 2007-08-04 12:16, kkirtac wrote:
On Aug 4, 12:52 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
>"kkirtac" <kadir.kir...@gmail.comwrote in message

news:11*********************@d55g2000hsg.googlegr oups.com...
Hello, i will simply state algorithm of the problem :
root "r" = GetRootDirectory( );
foreach child directory "c" of "r"
foreach file "f" of "c"
process f ;
endfor
endfor
"process" is not important here, the main problem is how i can reach a
directory, how i can visit all of its childs and catch the files of
all childs sequentially.

Since you gave psuedo code and haven't said what OS, etc.. I'll treat this
as an algorithm problem. Not totally OT but...

Normally I would use recursion for this.

root "r" = GetRootDirectory( );
ProcessDirectory( root );
// done

ProcessDirectory( path )
for each entry in path
if entry is file
process file
else if entry is path
ProcessDirectory( path )
endfor

Hello, i m sorry i am on a VC++ - Win32 Console project in Visual
Studio 2005..yes i think i need recursion..i m a bit
complicated..which class to use and how..anyway, wrong place to ask
maybe, thanks
Take a look at the faq, section 5.9 for some suggestions on where better
to ask this question: http://www.parashift.com/c++-faq-lite/
Also, msdn.microsoft.com is a good source and Barry suggested
FindFirstFile() which might be useful.

--
Erik Wikström
Aug 4 '07 #5

Alf P. Steinbach <al***@start.nowrote in message...
* kkirtac:
Hello, i will simply state algorithm of the problem :

root "r" = GetRootDirectory( );
foreach child directory "c" of "r"
foreach file "f" of "c"
process f ;
endfor
endfor

"process" is not important here, the main problem is how i can reach a
directory, how i can visit all of its childs and catch the files of
all childs sequentially.

Check out the Boost library's file and directory support.
FWIW: wxWidgets has a nice set of classes for file/directory.
Most people think of wxWidgets as a GUI, but, it has a flag to turn off the
GUI build.

--
Bob R
POVrookie
Aug 4 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John | last post by:
Hi everyone ! This is a first time I post a message here. If I post my message in a wrong group. Please ignore it. I am trying to build a website which allows users (can be thousands of...
6
by: Anders Søndergaard | last post by:
Hi, I'm trying to process a large filesystem (+20 million files) and keep the directories along with summarized information about the files (sizes, modification times, newest file and the like)...
5
by: Anand K Rayudu | last post by:
Hi all, I am trying to find a way to get the files recursively in a given directory, The following code is failing, can some one please suggest what could be problem here from os import...
6
by: Sylvain Thenault | last post by:
Hi there ! I've some questions regarding pth files (which btw are undocumented in the python reference, is this intentional ?) I thought that I could use a .pth file to be able to import zope...
3
by: Jim | last post by:
Is it possible to read the Temporary Internet Files folder using C#? I'm messing with FileIO (newbie here) and everything seems to work fine until I try to read the list of files in this Temporary...
4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
6
by: Steven | last post by:
I have a problem with moving the backup of my database from machine to machine. The size is 17 Gig and my network keeps timing out when I try to ftp it from machine to machine. I have had the...
1
by: Xah Lee | last post by:
Text Processing with Emacs Lisp Xah Lee, 2007-10-29 This page gives a outline of how to use emacs lisp to do text processing, using a specific real-world problem as example. If you don't know...
2
by: Thanneman | last post by:
Hi There, I have a question about a program I'm writing. The program has to do the following: 1) recursive look files in directory 2) process all the files found in the directories Point 1...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.