Beispiel #1
0
 def delete_file(cls, real_file, failsafe=True):
     try:
         delete_file(real_file)
     except:
         logging.exception("delete file error")
         if not failsafe:
             raise
Beispiel #2
0
def delete_job_file(request, f):
    import base64
    file_path = os.path.join(get_config('env', 'workspace'),
                             str(request.user.id), base64.b64decode(f))
    delete_file(file_path)

    return success('Deleted')
Beispiel #3
0
 def delete_file(cls, real_file, failsafe=True):
     try:
         delete_file(real_file)
     except:
         logging.exception("delete file error")
         if not failsafe:
             raise
Beispiel #4
0
         save_info(f'File {name} is created')
 elif command == '2':
     name = input('Enter folder name: ')
     if name == '':
         print('Folder name is missing')
         save_info('Error - Folder name is missing')
     else:
         create_directory(name)
         save_info(f'Folder {name} is created')
 elif command == '3':
     name = input('Enter file or folder name: ')
     if name == '':
         print('File or folder name is missing')
         save_info('Error delete - File or folder name is missing')
     else:
         delete_file(name)
         save_info(f'Deleted {name}')
 elif command == '4':
     name = input('Enter file or folder to copy: ')
     new_name = input('Enter the new destination: ')
     if name == '':
         print('File or folder name is missing')
         save_info('Error copy - File or folder name is missing')
     else:
         try:
             copy_file(name, new_name)
         except FileNotFoundError:
             print('New destination is missing')
             save_info('Error copy - New destination is missing')
         else:
             copy_file(name, new_name)