Copying all files in a directory

This is a discussion on Copying all files in a directory within the C Programming forums, part of the General Programming Boards category; Hi all, I need to write a C program to copy all files in a directory to another directory. Only ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    22

    Copying all files in a directory

    Hi all,
    I need to write a C program to copy all files in a directory to another directory. Only the directory name will be specified as the source. Can anyone tell me how I should go about it? I will be doing it in Windows. Is there any way I can do this using only standard C functions and not any API's?

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    The FAQ answers all of your questions (including it being non-standard) : http://faq.cprogramming.com/cgi-bin/...&id=1044780608

  3. #3
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Well, the operation is OS based, I don't think there is a way to do that with only standard C, meaning being compatible in all systems.

    In windows there is MoveFile() http://msdn.microsoft.com/en-us/library/aa365239.aspx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. copying files from a directory into another one
    By smoking81 in forum Linux Programming
    Replies: 7
    Last Post: 11-23-2008, 07:35 AM
  2. deleting all files in a directory using c..
    By ShadeS_07 in forum C Programming
    Replies: 6
    Last Post: 07-30-2008, 09:21 AM
  3. Replies: 4
    Last Post: 07-24-2008, 10:02 AM
  4. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-20-2003, 09:12 PM
  5. searching files in directory
    By lobo in forum Windows Programming
    Replies: 5
    Last Post: 10-05-2001, 04:00 AM

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