Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Trial Reseter for MAC
import os
from pathlib import Path
from sys import argv
class ResetTrial:
path = str(Path().home()) + "/Library/"
file_array = []
dir_array = []
def iterate_over_files(self, subString):
for dir_path, sub_dir_path, files in os.walk(self.path):
for file in files:
found = subString in str(file).lower()
if found:
self.file_array.append(str(os.path.join(dir_path, file)))
for direc in sub_dir_path:
found = subString in str(direc).lower()
if found:
self.dir_array.append(str(os.path.join(dir_path, direc)))
def perform_reset_trial(self):
print("*" * 40)
alert = """
Are these files/Directories looks good to you? If yes
Enter y or Y to continue : """
value = input(alert)
if value.lower() == "y":
for file in self.file_array:
os.system("rm {}".format(file))
for dirs in self.dir_array:
os.system("rm -rf {}".format(dirs))
print("Successfully reset trial!!!")
def print_files_dirs(self):
print("-" * 10 + " Files " + "-" * 10)
print(*self.file_array, sep="\n")
print("-" * 10 + " Directories " + "-" * 10)
print(*self.dir_array, sep="\n")
if __name__ == "__main__":
print("-" * 40)
alert = """
Always provide valid input, which you want to search for application data and reset trial.
This could delete useful files if you enter wrong input. Use at your own risk.
Provide valid string to reset trial. (Ex. Enter proxifier to reset trial for proxifier)
print("-" * 40)
value = input("Enter y or Y to continue: ")
if value.lower() == "y":
reset_trial = ResetTrial()
string_need_to_found = input("Enter keywork or name of application : ")
if not string_need_to_found.strip():
print("Provide a valid string to search in files and directories")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment