def delete_file(self): pathPattern() source = input("Insert the source path (including the file): ") if os.path.isfile(str(source)): os.remove(str(source)) logger.info("File has been removed") else: logger.fatal("Inserted path is incorrect")
def copy_folder(self): pathPattern() source = input("Insert the source path: ") destination = input("Insert the destination path: ") try: shutil.copytree(str(source), str(destination)) logger.info("Folder has been copied to {}".format(str(destination))) except: logger.fatal("Couldn't do the operation. Please check your inserted paths.")
def move(self): pathPattern() source = input("Insert the source path (including the file): ") destination = input("Insert the destination path: ") try: shutil.move(str(source), str(destination)) logger.info("File has been moved to {}".format(str(destination))) except: logger.fatal("Couldn't do the operation. Please check your inserted paths.")
def delete_folder(self): pathPattern() source = input("Insert the source path: ") if os.path.isdir(str(source)): os.rmdir(str(source)) logger.info("Folder has been removed") else: logger.fatal("Inserted path is incorrect")
def create_file(self): pathPattern() source = input("Insert a directory: ") extension = input("Insert the file type (extension): ") name = input("Insert the file name: ") file_name = source + '\\' + name + '.' + extension file = open(file_name, "w+") edit = input("Would you like to write something in the file?") if edit == 'yes' or 'y': content = input("Type your input: ") file = open(file_name, "a+") file.write(content) logger.info("{} has been created".format(file_name)) else: logger.info("Ok, {} is an empty file for now".format(file_name))
def exit(self): logger.info("Bye!") exit()
def do_help(self, *args): logger.info(messages.help())
def do_gwen(self, *args): logger.info("Starting G.W.E.N") #TODO: Add the personal assistent