routine changes

This commit is contained in:
Joel Mathew Thomas
2024-05-11 15:10:56 +05:30
parent b1c60c2c30
commit eb31d5777e
9 changed files with 75 additions and 10 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env python
import os
def rename_folders_and_files(directory):
# First, rename files and directories in subdirectories
for root, dirs, files in os.walk(directory):
for d in dirs:
rename_folders_and_files(os.path.join(root, d))
# Then, rename files in the current directory
for root, dirs, files in os.walk(directory):
for f in files:
old_path = os.path.join(root, f)
new_path = os.path.join(root, f.lower().replace(" ", "_"))
os.rename(old_path, new_path)
# Finally, rename directories in the current directory
for root, dirs, _ in os.walk(directory):
for d in dirs:
old_path = os.path.join(root, d)
new_path = os.path.join(root, d.lower().replace(" ", "_"))
os.rename(old_path, new_path)
if __name__ == "__main__":
root_directory = input("Enter the root directory path: ")
rename_folders_and_files(root_directory)
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# Check if argument is provided
if [ $# -eq 0 ]; then
echo "Usage: $0 <commit_message>"
exit 1
fi
# Add all changes
git add .
# Commit with the provided argument
commit_message="$1"
git commit -m "$commit_message"
# Push changes to the master branch of the origin remote
git push -u origin master
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
# Check if rofi is already running
if pgrep -x "rofi" > /dev/null
then
# If running, kill rofi
pkill -x rofi
else
# If not running, launch rofi
rofi -show drun &
fi