Well, today my boss “forgot” how to batch rename files in dos. He had a bunch of numbered jpg images like 001.jpg and 002.jpg and needed them renamed to 301.jpg and 302.jpg etc etc. He is an “engineer” from romania and i quote “When I used to do it, it was much simpler, such as C:\copy *.jpg 100+*.jpg or similar.” Now I’ve been using DOS since 6.22 and to my knowledge copy has NEVER worked like that. Of course i cant just call my boss out so i linked him to some yahoo answers page about how to do it. Being an “engineer” i figured he could READ the page and figure out how to modify the script to suit his needs. He then emails me back and says “Please use the info below and tell me what I need to enter”. LOL. Great. Why cant you just fucking use TotalCommander or some other Windows Commander style application that has a built in rename function?? Or download one of the 100′s of shareware/freeware renamer programs. You DO have antivirus right? Or did you not keep it updated like i told you to? /rant
So anyway, i did it, here it is:
@echo off SETLOCAL EnableDelayedExpansion for /f "tokens=1-2 delims=." %%i in ('dir /b *.jpg') do ( SET /A var=%%i+300 copy %%i.%%j !var!.%%j )
All the script does is a for loop in which it runs a “dir” command and takes the filename (%%i) and adds 300 since the files are numeric and /A means use arithmetic. Then it issues a copy command to make a new copy of the file now with the new number.
Couple things i had forgot about writing dos bat files:
1. While in Cmd all your variables work with a single % but when running the .bat file you have to use 2 ie: %%i otherwise they wont work
2. if you SET a variable and need to call it later %var% doesnt work! you must use !var!
And btw, wtf Microsoft. Why is there no fucking batch rename tool built into windows? Dont you think that might be a handy feature for anyone that has a digital camera? Thats nice you can shout at your Kinect and it will play a youtube or netflix video, but some of us need to do work with computer still and having the OS actually have these types of features that should have been implemented a decade ago might be handy.
Ok, so if you didnt already know…im kind of a geek. My favorite subject in school has been and will always be math. Well…as long as its not trigonometry Recently I even watched some videos from MIT about linear algebra.
Anyway, i was browsing the web today and found a link to Microsoft Mathematics 4.0.
Here’s the description from their website:
Microsoft Mathematics provides a graphing calculator that plots in 2D and 3D, step-by-step equation solving, and useful tools to help students with math and science studies.
And holy crap it does do it step-by-step. It does algebra, statistics, trigonometry, linear algebra, and calculus! And its free!
This could come in handy for a lot of students out there or just other geeks like me.