Main function to handle command-line arguments and call the renaming function. Usage: ------ python script_name.py Example: -------- python rename_files_script.py /path/to/directory
()
| 57 | |
| 58 | |
| 59 | def main() -> None: |
| 60 | """ |
| 61 | Main function to handle command-line arguments and call the renaming function. |
| 62 | |
| 63 | Usage: |
| 64 | ------ |
| 65 | python script_name.py <directory_path> |
| 66 | |
| 67 | Example: |
| 68 | -------- |
| 69 | python rename_files_script.py /path/to/directory |
| 70 | |
| 71 | """ |
| 72 | # Create a parser for command-line arguments |
| 73 | parser = argparse.ArgumentParser( |
| 74 | description="Rename files and folders to lowercase with underscores." |
| 75 | ) |
| 76 | parser.add_argument( |
| 77 | "directory", |
| 78 | type=str, |
| 79 | help="Path to the directory containing the files and folders to be renamed.", |
| 80 | ) |
| 81 | args = parser.parse_args() |
| 82 | |
| 83 | # Call the rename_files_and_folders function with the provided directory path |
| 84 | rename_files_and_folders(args.directory) |
| 85 | |
| 86 | |
| 87 | if __name__ == "__main__": |
no test coverage detected