import os def rename_folder(): # Get the current working directory current_dir = os.getcwd() print(f"Current directory: {current_dir}") # Prompt user for the current folder name and new folder name current_name = input("Enter the current folder name to rename: ") new_name = input("Enter the new folder name: ") # Construct full paths current_path = os.path.join(current_dir, current_name) new_path = os.path.join(current_dir, new_name) try: # Rename the folder os.rename(current_path, new_path) print(f"Folder '{current_name}' renamed to '{new_name}' successfully.") except FileNotFoundError: print(f"Error: Folder '{current_name}' does not exist in {current_dir}.") except PermissionError: print( "Error: Permission denied. Try running the script with administrator privileges." ) except Exception as e: print(f"An unexpected error occurred: {e}") if __name__ == "__main__": rename_folder()