forked from uc-cdis/commons-frontend-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(resultsAppSetup): renamed all .stories.jsx files to .oldStories.tsx
- Loading branch information
1 parent
a903ca7
commit 2d61883
Showing
9 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import fnmatch | ||
|
||
def change_file_extensions(root_dir): | ||
# Walk through all directories and files in the specified root directory | ||
for dirpath, dirnames, filenames in os.walk(root_dir): | ||
for filename in fnmatch.filter(filenames, '*.stories.jsx'): | ||
# Construct the full file path | ||
old_file_path = os.path.join(dirpath, filename) | ||
# Create the new file name by replacing the extension | ||
new_file_name = filename.replace('.stories.jsx', '.oldStories.tsx') | ||
new_file_path = os.path.join(dirpath, new_file_name) | ||
# Rename the file | ||
os.rename(old_file_path, new_file_path) | ||
print(f'Renamed: {old_file_path} to {new_file_path}') | ||
|
||
if __name__ == "__main__": | ||
# Specify the root directory you want to start from | ||
root_directory = './' # Change this to your target directory | ||
change_file_extensions(root_directory) |