Skip to content

Commit

Permalink
Update Symbolic Link at.py
Browse files Browse the repository at this point in the history
keep console open
  • Loading branch information
mrhartsclube authored Feb 17, 2024
1 parent 8bd8657 commit e7f3be1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Symbolic Link at.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import os
import sys
import tkinter as tk
from tkinter import filedialog
import time

def create_symlink(source, destination, is_directory):
"""
Expand All @@ -11,8 +14,11 @@ def create_symlink(source, destination, is_directory):
else:
os.system(f'mklink "{destination}" "{source}"')
print(f"Symlink created successfully: {destination} -> {source}")
time.sleep(2) # Keep the console open for 2 seconds after successful job
except Exception as e:
print(f"Error creating symlink: {e}")
input("Press Enter to exit...") # Wait for user input after error
sys.exit(1)

def main():
# Create Tkinter root window for the file dialog
Expand All @@ -23,6 +29,7 @@ def main():
destination_folder = filedialog.askdirectory(title="Select Destination Folder")
if not destination_folder:
print("No destination folder selected. Exiting.")
time.sleep(2) # Keep the console open for 2 seconds before exiting
sys.exit()

# Process files/folders passed as arguments
Expand All @@ -35,6 +42,8 @@ def main():
create_symlink(arg, destination_path, is_directory)
else:
print(f"Invalid file/folder path: {arg}")
input("Press Enter to exit...") # Wait for user input after error
sys.exit(1)

if __name__ == "__main__":
main()

0 comments on commit e7f3be1

Please sign in to comment.