How to create copy of Directory?

This is a discussion on How to create copy of Directory? within the C Programming forums, part of the General Programming Boards category; Dear All, I got one new requirement from customer...requirement is:- Code: 1. How to get the copy of folder which ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    83

    How to create copy of Directory?

    Dear All,
    I got one new requirement from customer...requirement is:-
    Code:
    1. How to get the copy of folder which is there in C:\ drive to 
        D:\ drive...
        Ex: if i have one folder CAN in C:\ drive means i should get the 
       copy of this folder into my D:\ drive with any name
    
    2. This folder consists of both .C and .H files how to identify files
         by there extension name...
    Using C programming i have to achieve all these things...can anybody help to this..i am new to C programming..i know very well about files..but operations of folders i don't know..thanks for your valuable suggestion...

    Regards,
    Shwetha

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    You have to create a new directory and manually copy all files over. Is there a file copy function in C, though? I don't know one.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You need to find the files in a directory, code for which can be found in the FAQ, then using code to read the source file and write the destination the file.

    Identifying files is similar - scan the contents of the directory and find the .something part of the filename, then use that to present the identity.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    83

    i searched entire FAQ..could you provide link??

    Quote Originally Posted by matsp View Post
    You need to find the files in a directory, code for which can be found in the FAQ, then using code to read the source file and write the destination the file.

    Identifying files is similar - scan the contents of the directory and find the .something part of the filename, then use that to present the identity.

    --
    Mats
    Hai Matsp...

    i couldn't able to generate logic for seprating files in directory defending on extension
    could you explain briefly logic..i am thankful to you

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Look at the name-string, (start from the back) to find the last ., then take the text after that ., and determine what it means.

    Perhaps it's better if you post your code?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copying a whole directory and its content
    By Enira in forum C Programming
    Replies: 4
    Last Post: 03-12-2006, 01:13 PM
  2. calling copy constructor from template
    By Ancient Dragon in forum C++ Programming
    Replies: 3
    Last Post: 09-28-2005, 01:54 PM
  3. Copy constructors and operator=()
    By filler_bunny in forum C++ Programming
    Replies: 13
    Last Post: 08-25-2003, 07:43 AM
  4. open directory and copy files
    By 5n4k3 in forum C++ Programming
    Replies: 3
    Last Post: 08-06-2003, 09:49 AM
  5. Replies: 6
    Last Post: 07-30-2003, 03:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21