Thread: Working with directories...

  1. #1
    C Seņor
    Guest

    Question Working with directories...

    Hi, I need some help getting started using C to work with directories, and some files within them.

    Firstly, I need to change the path to a particular directory.

    This directories has about 10 directories, each with about 10-20 files that I need to process with a separate batch file.

    If the process fails, I need those files to be put into a 'Bad Process' directory so I know which files need to be fixed.

    So, I want to start with the first directory, find the first file, run the batch file that manipulates that file, then continue on to the next file.

    Once it has processed each file in the first directory, I need it to move on to the next directory and repeat the process until all directories have been worked through.


    Can anyone recommend a tutorial that deals with this specifically? Or maybe someone here knows how to handle this...

    Thanks a lot,
    C Seņor

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    try looking into the funtions opendir(), readdir(), closedir() or _findfirst(), _findnext(), findclose()

    and you will most likely need to use recursion in searching directoies
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    C Seņor
    Guest
    Ok...I need a good web site that clearly details what each function in each class does.

    And also, those functions are part of which class?

  4. #4
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Originally posted by C Seņ¯˛..
    And also, those functions are part of which class?
    Class?? Please, no profanity on the C forum ;)

    opendir(), readdir(), and closedir() are part of the POSIX standard, which is great if you are programming in *NIX. I'm not certain what the Windows counterparts are, but the folks in the Windows forum are sure to know.
    Jason Deckard

  5. #5
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    info on _findfirst(), _findnext(), findclose() can be located one

    http://msdn.microsoft.com

    as for opendir(), readdir(), and closedir() im not sure but a http://www.google.com search should come up with something.

    good luck.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 06-30-2005, 08:03 AM
  2. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  3. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 08:35 PM
  4. ANSI - working with directories
    By sean345 in forum C Programming
    Replies: 1
    Last Post: 06-01-2002, 04:43 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM