def rmdirtree(path): """ Elimina un directorio y su contenido @param path: ruta a eliminar @type path: str @rtype: bool @return: devuelve False en caso de error """ path = encode(path) if path.lower().startswith("smb://"): try: for raiz, subcarpetas, ficheros in walk(path, topdown=False): samba.delete_files(ficheros, raiz) for s in subcarpetas: samba.delete_directory(s, raiz) except: pass else: import shutil shutil.rmtree(path, ignore_errors=True) if exists(path): # No se ha eliminado return False return True
def remove(path): """ Elimina un archivo @param path: ruta del fichero a eliminar @type path: str @rtype: bool @return: devuelve False en caso de error """ path = encode(path) if path.lower().startswith("smb://"): try: samba.delete_files(os.path.basename(path), os.path.dirname(path)) except: import traceback logger.info( "deportesalacarta.core.filetools mkdir: Error al eliminar el archivo " + traceback.format_exc()) platformtools.dialog_notification("Error al eliminar el archivo", path) return False else: try: os.remove(path) except OSError: import traceback logger.info( "deportesalacarta.core.filetools mkdir: Error al eliminar el archivo " + traceback.format_exc()) platformtools.dialog_notification("Error al eliminar el archivo", path) return False return True
def remove(path): """ Elimina un archivo @param path: ruta del fichero a eliminar @type path: str @rtype: bool @return: devuelve False en caso de error """ path = encode(path) if path.lower().startswith("smb://"): try: samba.delete_files(os.path.basename(path), os.path.dirname(path)) except: import traceback logger.info("pelisalacarta.core.filetools mkdir: Error al eliminar el archivo " + traceback.format_exc()) platformtools.dialog_notification("Error al eliminar el archivo", path) return False else: try: os.remove(path) except OSError: import traceback logger.info("pelisalacarta.core.filetools mkdir: Error al eliminar el archivo " + traceback.format_exc()) platformtools.dialog_notification("Error al eliminar el archivo", path) return False return True
def remove(path): """ Elimina un archivo @param path: ruta del fichero a eliminar @type path: str """ path = encode(path) if path.lower().startswith("smb://"): samba.delete_files(os.path.basename(path), os.path.dirname(path)) else: os.remove(path)
def deletebookmark(fullfilename, deletepath=BOOKMARK_PATH): logger.info("streamondemand.channels.favoritos deletebookmark(fullfilename="+fullfilename+",deletepath="+deletepath+")") if not samba.usingsamba(deletepath): os.remove(os.path.join(urllib.unquote_plus(deletepath), urllib.unquote_plus(fullfilename))) else: fullfilename = fullfilename.replace("\\", "/") partes = fullfilename.split("/") filename = partes[len(partes)-1] logger.info("streamondemand.channels.favoritos filename="+filename) logger.info("streamondemand.channels.favoritos deletepath="+deletepath) samba.delete_files(filename, deletepath)