<filename>scanner/delete_files.py
import os

# Delete a file or multiple files (Handles all aspects of the deleting process starting from asking the user and ending with actual deleting)
def delete_files(files, one_file=False):
	global decision
	if(one_file == False):
		num_detected = len(files)
		while(True):
			decision = input("\n\nDo you want to delete all malicious files (Y/n)?")
			if(decision == "Y" or decision == "y" or decision == "n" or decision == "N" or decision == ""):
					break
		if(decision == "y" or decision == "Y" or decision == ""):
			# Deleting all malicious files
			num_failed_to_delete = 0
			print("\nDeleting all files ...")
			for file in files:  	# O(N)
				try:
					os.remove(file)  # O(1)
					print("File (" + file + ") is deleted successfully!")
				except OSError:
					num_failed_to_delete += 1
					print("File (" + file + ") is NOT deleted!")
					
			print("\n\nNumber of malicious files deleted: " + str(num_detected-num_failed_to_delete))
			print("Number of malicious files NOT deleted: " + str(num_failed_to_delete))
				
		elif(decision == "n" or decision == "N"):
			print("The malicious files are NOT deleted!")

	else:
		# The parameter files represents a signle file O(1)
		file = files
		# Deleting the malicious file
		while(True):
			decision = input("\n\nDo you want to delete this file (Y/n)?")
			if(decision == "Y" or decision == "y" or decision == "n" or decision == "N" or decision == ""):
				break
		if(decision == "y" or decision == "Y" or decision == ""):
			# Deleting all malicious files
			print("\nDeleting the file ...")
			try:
				os.remove(file) # O(1)
				print("File (" + file + ") is deleted successfully!")
			except OSError:
				print("File (" + file + ") is NOT deleted!")

		elif(decision == "n" or decision == "N"):
			print("The file is NOT deleted!")

<filename>scanner/delete_files.py
import os

# Delete a file or multiple files (Handles all aspects of the deleting process starting from asking the user and ending with actual deleting)
def delete_files(files, one_file=False):
	global decision
	if(one_file == False):
		num_detected = len(files)
		while(True):
			decision = input("\n\nDo you want to delete all malicious files (Y/n)?")
			if(decision == "Y" or decision == "y" or decision == "n" or decision == "N" or decision == ""):
					break
		if(decision == "y" or decision == "Y" or decision == ""):
			# Deleting all malicious files
			num_failed_to_delete = 0
			print("\nDeleting all files ...")
			for file in files:  	# O(N)
				try:
					os.remove(file)  # O(1)
					print("File (" + file + ") is deleted successfully!")
				except OSError:
					num_failed_to_delete += 1
					print("File (" + file + ") is NOT deleted!")
					
			print("\n\nNumber of malicious files deleted: " + str(num_detected-num_failed_to_delete))
			print("Number of malicious files NOT deleted: " + str(num_failed_to_delete))
				
		elif(decision == "n" or decision == "N"):
			print("The malicious files are NOT deleted!")

	else:
		# The parameter files represents a signle file O(1)
		file = files
		# Deleting the malicious file
		while(True):
			decision = input("\n\nDo you want to delete this file (Y/n)?")
			if(decision == "Y" or decision == "y" or decision == "n" or decision == "N" or decision == ""):
				break
		if(decision == "y" or decision == "Y" or decision == ""):
			# Deleting all malicious files
			print("\nDeleting the file ...")
			try:
				os.remove(file) # O(1)
				print("File (" + file + ") is deleted successfully!")
			except OSError:
				print("File (" + file + ") is NOT deleted!")

		elif(decision == "n" or decision == "N"):
			print("The file is NOT deleted!")

# Delete a file or multiple files (Handles all aspects of the deleting process starting from asking the user and ending with actual deleting) # Deleting all malicious files # O(N) # O(1) # The parameter files represents a signle file O(1) # Deleting the malicious file # Deleting all malicious files # O(1)