Let's be real—my "Downloads" and "E-Books" folders were on the verge of becoming digital wastelands. It started off innocently enough: saving PDFs here and there, organizing e-books into folders by genre or author. But fast forward a few months and I was staring at a mess of nested directories, duplicate PDFs, and an overwhelming sense of where do I even begin?
That's when I turned to my trusty assistant—ChatGPT—for a little automation magic. And wow, did it deliver.
Mission 1: Unleash the Files from the Folder Maze
The first problem? I had tons of e-books scattered across dozens of subfolders inside D:\My Files\My E-Books
. My goal was simple: flatten the folder structure by moving every file into the main My E-Books
folder.
The result? A simple but effective batch script that looped through all subfolders and migrated every file to the root directory. Just like that, the folder chaos was neutralized. It felt like giving my hard drive a deep tissue massage.
No more "Where did I put that PDF?" moments. Everything was just... there.
setlocal enabledelayedexpansion
cd /d "D:\My Files\My E-Books"
REM Loop through all subfolders
for /d %%F in (*) do (
if not "%%F"=="." if not "%%F"==".." (
REM Move files from subfolder to current folder
move "%%F\*" . >nul 2>&1
)
)
echo Done moving files to root folder.
pause
Mission 2: The Great PDF Sorting Rebellion
Now, flipping the scenario. I had a bunch of standalone PDFs in one folder, and instead of scattering them into different folders like before—I wanted the opposite: each PDF should live in its own folder, named exactly after the PDF itself. Bonus points if the PDF got moved into its respective folder right away.
Again, ChatGPT came through with another slick batch file that:
.pdf
).setlocal enabledelayedexpansion
for %%F in ("*.pdf") do (
set "filename=%%~nF"
mkdir "!filename!" 2>nul
move "%%F" "!filename!\"
)
echo PDFs have been moved into their respective folders.
pause
The result? Instant order. It was like my PDFs had personal apartments now instead of crashing together in a messy dorm.
Why This Matters (and Feels So Good)
If you've ever struggled with digital clutter, you know how much time it can waste and how much brain fog it creates. These two scripts didn't just clean up my folders—they gave me back a sense of control.
No more hunting. No more duplicate copies. Just a clean, logical structure that makes sense.
Final Thoughts
Sometimes, the smallest automation can bring the biggest sighs of relief. If your files are piling up like mine were, don't wait. Batch scripts like these take seconds to run—but the satisfaction of a clean file system? That lasts much longer.
Comments