Creating Folders

This is a discussion on Creating Folders within the C++ Programming forums, part of the General Programming Boards category; I want to create a folder, and I am unsure how to do this. I want to place all the ...

  1. #1
    Folder Help Man
    Guest

    Creating Folders

    I want to create a folder, and I am unsure how to do this. I want to place all the files from a program in this folder. Also, if I have an uninstall type of thing for one of my programs, how would I got about deleting the folder? I had found something looking like the code below, but I am unsure if this works or not...Any help is greatly needed and appreciated.

    Code:
    system("rmdir C:\\Directory");
    Thanks in advance for all help!

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    In dir.h (if your compiler has it) you'll find a lot of directory related functions - chdir,rmdir,getcurdir etc

    If you tell us about your compiler/os then people here might help you better. I'm assuming Borland/Windows-Dos

    that will work and remove the direectory if it is empty i think. But that is slow.
    Last edited by ihsir; 07-08-2002 at 10:19 PM.
    -

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    145
    Alright, I will have to check out that dir.h. Now, you had said that the way I knew to delete folders was slow. Do you mean REALLY slow? Is there a faster (and relatively simple ) way to do it? Please, any help is appreciated.
    "Um...well..."
    -Kyoto Oshiro

  4. #4
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    I haven't used system() but everyone says that it is slow. Wether it is 'slow' by computer std or by normal std is something i cant really tell you much about.

    I use the following method to delete folders:

    1. Use the findfirst() and findnext() to see the file contents of that dir.

    2. If files are present then use remove() to delete them

    3. Then use rmdir() to delete the folder.

    But all the 3 functions are in dir.h except remove which is in stdio


    I dont think it tells if there are sub-dirs in there too.

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    145
    I was planning on deleting each file in the folder (as they will most likely all be created by my program), then removing the program. I tried out the system thing way of deleting the folder, and it seemed okay to me. But thank you for your help ihsir. Oh, and you can check out my program that I am talking about at the link below. It isn't finished, but it is playable and the source and library are there.
    "Um...well..."
    -Kyoto Oshiro

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error while trying to list folders
    By Hellbinder in forum Networking/Device Communication
    Replies: 5
    Last Post: 06-12-2009, 06:27 PM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 10:38 AM
  3. Help with folders
    By FlyingIsFun1217 in forum C++ Programming
    Replies: 5
    Last Post: 10-21-2006, 10:41 AM
  4. Reading filenames and creating folders
    By Bitphire in forum C++ Programming
    Replies: 2
    Last Post: 03-03-2005, 01:38 PM
  5. Creating Folders
    By X PaYnE X in forum Windows Programming
    Replies: 2
    Last Post: 09-21-2004, 05:18 AM

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