https://github.com/kuldeeppatil45/renaming-all-files-in-a-folder-sequentially
https://github.com/kuldeeppatil45/renaming-all-files-in-a-folder-sequentially
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kuldeeppatil45/renaming-all-files-in-a-folder-sequentially
- Owner: Kuldeeppatil45
- Created: 2024-11-21T16:54:26.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-21T17:03:41.000Z (7 months ago)
- Last Synced: 2025-01-31T06:32:06.543Z (4 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Renaming-All-Files-in-a-Folder-Sequentially
## Description:
This script renames all files in a specified folder sequentially, starting from 1.ext, 2.ext, and so on, while preserving the original file extensions. Directories and hidden files are ignored.## Features:
Renames only regular files.
Retains file extensions.
Sorts files alphabetically before renaming.
Handles invalid folder paths and permission issues gracefully.
Skips empty folders or non-renamable files.## Usage:
Save the script to a file, e.g., RenamingFiles.py.py.## Run the script:
python RenamingFiles.py.py
Enter the folder path when prompted.## Example:
Input: Please enter the path to the folder: /path/to/folderOutput:
Renaming files...
- File 'image1.jpg' renamed to '1.jpg'
- File 'document.txt' renamed to '2.txt'
- File 'report.pdf' renamed to '3.pdf'
- File 'notes.docx' renamed to '4.docx'
- File 'music.mp3' renamed to '5.mp3'
Renaming completed.## Edge Cases:
Invalid folder path:
Error: The folder '/path/to/folder' does not exist.## Empty folder:
The folder is empty. No files to rename.## Permission issues:
Error: Unable to rename file 'image1.jpg' due to permission issues.