Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
finding and deleting folders in c++
Name: trevor Date: October 21, 2002 at 14:55:22 Pacific OS: windows 2000 CPU/Ram: 866/512
Comment:
Can someone tell me how i can get a list of subdirectories and store them into an array? for example, at the DOS command prompt if you type in 'dir' it gives you a list of subdirectories...i want to do that and put them into an array. Also, i'd like to know how to delete a folder and its contents...like deltree in DOS.
Name: uday Date: October 22, 2002 at 03:25:52 Pacific
Reply:
TO delete a directory we must know the directory structure first,that u can see in #include and u have to include the directory name like file name . DIR *dir; and u also have to crate the DIrectory structure by struct dirent *sub; and u have to open the directory first by dir=opendir("DIRECTORY NAME"); then u have to read that by sub=readdir("dir"); u will get contents in to sub u can display the names by sub->d-name; u can do any operations on them now.
Summary: i have 2 questions regarding files in C++. the first, how can you make folders, and how can you delete files and folders. this is for a console application. ...
Summary: I am trying to search the C:Documents and Settings folder and find a specific folder name and have it get deleted. I have several users on one computer so it needs to look in each user name directory ...