Are you tired of manually updating file references in your project? Look no further than Reference Medic! This tool scans your project's files and updates any file references to adhere to your specified file structure.
To use Reference Medic, simply run the script and provide the top-level folder of your project as the argument. The script will then recursively scan through all subfolders and update any file references as necessary.
ReferenceMedic("path/to/project_folder") File Structure Rules Reference Medic currently supports the following file structure rules:
- If the file being referenced is a .json file, the relative path will be changed to ../config/{filename}
- If the file being referenced is a .csv file, the relative path will be changed to ../config/{filename}
- .html files are now stored in the ../html folder
- .css files are in the ../css folder
- Any image files (.jpg, .jpeg, .png, .gif) are now in the ../images folder
- .log files are in the ../logs folder
- .py files are now in ../src
- .txt files are in ../txt
- If the file being referenced is a .json file, the relative path will be changed to ./config/{filename}
- If the file being referenced is a .csv file, the relative path will be changed to ./config/{filename}
- .html files are now stored in the ./html folder
- .css files are in the ./css folder
- Any image files (.jpg, .jpeg, .png, .gif) are now in the ./images folder
- .log files are in the ./logs folder
- .py files are now in ./src
- .txt files are in ./txt
- Any other file types will raise an error.
with open("ppn_deck.json", "r") as read_file:
card_deck = json.load(read_file)
with open("../config/ppn_deck.json", "r") as read_file:
card_deck = json.load(read_file)
You can also customize the script to your own file structure rules by editing the code.
- Python
- Jupyter Notebook
- Visual Studio Code
- os
- pathlib
- json
- re
- Graham Waters - grahamwaters
This project is licensed under the MIT License - see the LICENSE.md file for details