Following a personal request from a family member. I wrote a script to rename files (type defined in, e.g. ".txt
") by removing special characters from a predefined list and replacing spaces with an underscore.
The original request has evolved, I now need to export files in a csv table to rename them manually.
The script takes only files from where is it. You must place it on the same path as the files to be renamed.
Considering this tree :
📂 Desktop/
├─ 📂 Memes/
│ └─ 📹 RickRoll.wav
├─ 📂 TestFolder/
│ ├─ 📂 1/
│ │ └─ 📄 text file.txt
│ ├─ 📜 .ExportFilesToCsv.ps1
│ ├─ 📜 .RenameCorrectlyFiles.ps1
│ ├─ 📜 .RenameCorrectlyFilesToCsv.ps1
│ ├─ 📄 another # test file---- .txt
│ ├─ 📄 a test file .txt
│ ├─ 📄 one more $ .txt
│ ├─ 📄 Ze last [test file].txt
│ └─ 🖼️ 2022-02-14-00042354.png
├─ 📂 UwU/
│ └─ 📄 Cat tier list.txt
-
.ExportFilesToCsv.ps1
... wich creates the file
Files_To_Rename.csv
Notepad Excel "Actual file name";"New file name" "a test file .txt";"" "another # test file---- .txt";"" "one more $ .txt";"" "Ze last [test file].txt";""
Actual file name New file name a test file .txt another # test file---- .txt one more $ .txt Ze last [test file].txt -
Modify csv with custom names
Notepad Excel "Actual file name";"New file name" "a test file .txt";"test_file.txt" "another # test file---- .txt";"another_file.txt" "one more $ .txt";"oneMore.txt" "Ze last [test file].txt";"TheLastTestFile.txt"
Actual file name New file name a test file .txt test_file.txt another # test file---- .txt another_file.txt one more $ .txt oneMore.txt Ze last [test file].txt TheLastTestFile.txt -
.RenamingFilesFromCsv.ps1