Thread: Traversing Directories

  1. #1
    C Minor

    Traversing Directories

    I want a program that will open a directory and traverse the entire tree under it, touching each file in every directory.

    Specifically, I'm going to read the extended attributes of every file -- I know how to do that, but I'm sure there's an easier method of getting every filename than by dumping a DIR and writing a parsing routine.

    Or is there?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    No, there isn't. You have to do a little work here! Nothing annoys me more than these sorts of questions. If you want an easy fix, then you should invest in some sort of third party middleware. If you are no good at programming then perhaps you should practice more. We welcome here specific questions from hard working programmers, not lazy minded script kiddies.
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  3. #3
    C Minor

    I know I've seen an elegant solution to this elsewhere, but haven't been able to find it. If you have any hints on where I might find a reference, feel free to suggest a place to search. I feel like I'm reinventing the wheel in coming up with a solution.

    Like what third party middlewhere, Sebastiana? If you have nothing to add, then don't waste the time typing. There's nothing more annoying than answers from lazy minded flame baiters.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    findfirst / findnext
    In whatever form your compiler has decided to spell them

  5. #5
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Bangalore, India
    If it's UNIX, check for opendir, readdir(), closedir()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. depth-first traversal of directories
    By geekoftheweek in forum C Programming
    Replies: 0
    Last Post: 03-31-2009, 01:22 AM
  2. Can't change directories via system("cd");
    By Frosty in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 10:45 AM
  3. VC6 directories
    By Magos in forum Tech Board
    Replies: 0
    Last Post: 03-11-2005, 05:52 PM
  4. Visual C/C++ directories
    By Magos in forum Tech Board
    Replies: 9
    Last Post: 04-15-2003, 08:45 PM
  5. Working with directories...
    By C Seņor in forum C Programming
    Replies: 4
    Last Post: 04-20-2002, 11:45 AM