Every line of 'python remove directory' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
608 def remove(self): 609 ''' 610 Remove directory tree. 611 612 :raises OutsideRemovableBase: when not under removable base directory 613 ''' 614 super(Directory, self).remove() 615 shutil.rmtree(self.path)
354 def Remove(args): 355 plugin_dir = GetPluginDir(args) 356 if os.path.exists(plugin_dir): 357 files_to_remove = GetFilesToCopy(plugin_dir) 358 RemoveFilesOrDirs(plugin_dir, files_to_remove)
23 def rmtree(top): 24 for root, dirs, files in os.walk(top, topdown=False): 25 for name in files: 26 filename = os.path.join(root, name) 27 os.chmod(filename, stat.S_IWRITE) 28 os.remove(filename) 29 for name in dirs: 30 rmtree(os.path.join(root, name)) 31 os.rmdir(top)
276 def rmdir(dirpath): 277 if not isdir(dirpath): 278 return 279 try: 280 rmtree(dirpath) 281 # we don't really care about errors that much. We'll catch remaining files 282 # with slower python logic. 283 except: 284 pass 285 286 for root, dirs, files in os.walk(dirpath, topdown=False): 287 for f in files: 288 unlink_or_rename_to_trash(join(root, f))
150 def remove(path): 151 exists = os.path.exists(path) 152 is_dir = os.path.isdir(path) 153 if not exists: return 154 if is_dir: shutil.rmtree(path, ignore_errors = False, onerror = _remove_error) 155 else: os.remove(path)
23 @staticmethod 24 def rmDir(path, force=False): 25 CraftCore.log.debug("deleting directory %s" % path) 26 try: 27 shutil.rmtree(path) 28 return True 29 except OSError: 30 return OsUtils.rm(path, force) 31 return False
209 def rmdir(self,file_path): 210 try: 211 shutil.rmtree(file_path) 212 except Exception as e: 213 print('Failed to delete %s. Reason: %s' % (file_path, e))
120 def _clean_up(self, path, remove_blacklist=True): 121 logger.debug("Cleaning up %s", path) 122 for f in os.listdir(path): 123 fpath = os.path.join(path, f) 124 if os.path.isdir(fpath): 125 if f in self._blacklist: 126 logger.info('Removing %s dir from %s', f, path) 127 shutil.rmtree(fpath, ignore_errors=False, onerror=onerror) 128 else: 129 self._clean_up(fpath, remove_blacklist=True)
147 def rm_dir(path): 148 if os.path.exists(path): 149 shutil.rmtree(path)
36 def rm(path: Path): 37 if path.is_symlink(): 38 path.unlink() 39 elif path.is_dir(): 40 shutil.rmtree(path) 41 else: 42 path.unlink()