existing TutorialDock Python app
This commit is contained in:
33
scripts/rename_folder.py
Normal file
33
scripts/rename_folder.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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()
|
||||||
5282
tutorial.py
Normal file
5282
tutorial.py
Normal file
File diff suppressed because it is too large
Load Diff
6
tutorials.bat
Normal file
6
tutorials.bat
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@echo off
|
||||||
|
set SCRIPT_DIR=%~dp0
|
||||||
|
pushd "%SCRIPT_DIR%"
|
||||||
|
start "" /B pythonw "tutorial.py"
|
||||||
|
popd
|
||||||
|
exit
|
||||||
Reference in New Issue
Block a user