Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a script that capitalizes all file names under a given directory #60

Merged
merged 1 commit into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Author: Deepak Chauhan
# Github: https://github.com/RoyalEagle73

import os
count = 0

## CODE TO CHECK AND PRINT FOR FILES HAVING LOWER CASE STARTING
for x,y,z in os.walk("Folder Location Here"):
root = str(x)
for i in z:
if i[0].islower():
count += 1


if count!=0:

print("%d files available for change"%(count))

response = input("Enter Y/N if want to continue to capitalize all of them :")

if response=='Y' or response=='y':
count = 0

# CODE TO CHANGE THE FILES
for x,y,z in os.walk("Folder Location Here"):
root = str(x)
for i in z:
if i[0].islower():
first_letter = i[0].upper()
final_command = "mv " + root+"/"+i +" "+(root+"/"+first_letter+i[1:])
count += 1
os.popen(final_command)
print(str(count) + " files changed\n\nThanks for using the tool :)")
else:
print("Thanks for using the tool :)")

else:
print("No files available for change.\nThanks for using the tool :)")
4 changes: 4 additions & 0 deletions System Scripts/Capitalize file names/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1) Edit Script with your desired file location
2) Run script and follow instrutions.

:)