Directory structure question

Discussion in 'Perl Misc' started by Bryan, Apr 5, 2007.

  1. Bryan

    Bryan Guest

    Hi,

    I have a directory structure like this:

    /data/exp/file1/file1.xml
    /data/exp/file2/file2.xml
    /data/exp/file3/file3.xml
    /data/file1/file1.xml
    /data/cust/exp/file1/file1.xml

    I need to read in the xml files, do some processing on them, and then
    output them to an identical directory structure, but with a different
    root name, like this:

    /data_out/exp/file1/file1.xml
    /data_out/exp/file2/file2.xml
    /data_out/exp/file3/file3.xml
    /data_out/file1/file1.xml
    /data_out/cust/exp/file1/file1.xml

    If the folders at each level do not exist, I would need to create them
    (assuming the xml processing passes some validation check). So if one
    file fails, it would just skip the creation of that directory.

    What is the best way to read in the directory tree, and then recreate it?

    Thanks,
    B
    Bryan, Apr 5, 2007
    #1
    1. Advertising

  2. Bryan

    Guest

    On Apr 4, 5:31 pm, Bryan <> wrote:

    > I need to read in the xml files, do some processing on them, and then
    > output them to an identical directory structure, but with a different
    > root name


    Try the dircopy() method of File::Copy::Recursive, which will clone
    the directory structure.

    --
    The best way to get a good answer is to ask a good question.
    David Filmer (http://DavidFilmer.com)
    , Apr 5, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. exquisitus
    Replies:
    6
    Views:
    518
    Scotchy
    Feb 18, 2005
  2. john
    Replies:
    4
    Views:
    672
    Jim Higson
    Jun 15, 2006
  3. Excluded_Middle

    Pointers to structure and array of structure.

    Excluded_Middle, Oct 24, 2004, in forum: C Programming
    Replies:
    4
    Views:
    752
    Martin Ambuhl
    Oct 26, 2004
  4. Leo Nunez
    Replies:
    3
    Views:
    1,213
    Neil Kurzman
    Feb 9, 2005
  5. Replies:
    2
    Views:
    605
Loading...

Share This Page