- Timestamp:
- Jan 15, 2006, 1:38:12 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/rmdirhier.cc
r49 r51 47 47 48 48 // Delete any remaining directory entries 49 DIR *dirp;49 DIR* dp; 50 50 struct dirent *entry; 51 if (!(d irp =opendir(".")))51 if (!(dp=opendir("."))) 52 52 throw DirectoryOpenError(dir); 53 while ((entry = readdir(dirp)) != NULL) {54 struct stat finfo;53 while ((entry=readdir(dp)) != NULL) { 54 struct stat buf; 55 55 if (entry->d_name[0] == '.') 56 56 continue; 57 stat(entry->d_name,& finfo);58 if ( finfo.st_mode & S_IFDIR)57 stat(entry->d_name,&buf); 58 if (buf.st_mode & S_IFDIR) 59 59 rmdirhier__(entry->d_name); // sub-directory 60 60 else { 61 // Enable delete of file, then doit61 // Make sure file is removable before removing it 62 62 chmod(entry->d_name,S_IWRITE); 63 63 if (unlink(entry->d_name)) … … 65 65 } 66 66 } 67 closedir(d irp);67 closedir(dp); 68 68 69 69 // Remove the directory from its parent
Note: See TracChangeset
for help on using the changeset viewer.