Exemplo n.º 1
0
    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")
Exemplo n.º 2
0
    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.")
Exemplo n.º 3
0
    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.")
Exemplo n.º 4
0
    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")