Thread: Copying all files in a directory

  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, 08:21 AM
  3. Replies: 4
    Last Post: 07-24-2008, 09: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, 08:12 PM
  5. searching files in directory
    By lobo in forum Windows Programming
    Replies: 5
    Last Post: 10-05-2001, 03:00 AM