Computing.Net > Forums > Programming > finding and deleting folders in c++

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++

Reply to Message Icon

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.



Sponsored Link
Ads by Google

Response Number 1
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.


0
Reply to Message Icon

Related Posts

See More


Date Calculations in KSH How can I skip something ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: finding and deleting folders in c++

Making and deleting folders in C++ www.computing.net/answers/programming/making-and-deleting-folders-in-c/3490.html

Find and Delete Folders using a bat www.computing.net/answers/programming/find-and-delete-folders-using-a-bat/18643.html

Deleting folders in C++ www.computing.net/answers/programming/deleting-folders-in-c/3611.html