Quickly renaming multiple file extensions with bash

Posted by & filed under Uncategorized.

I needed to quickly rename a bunch of file extensions in a directory. This one liner made quick work of it:

for old in *.JPG; do cp $old `basename $old .JPG`.jpg; done

basename, when given a file name and a extension spits out something like this:

user@server$ basename derp.txt .txt

Which we then use to append the proper extension (.jpg) in the example and done.

[Windows] Finding a string in a bunch of files, then processing each of those files

Posted by & filed under Programming, Server Admin.

I had a task where there were thousands of files in a folder. Some of them contained a specific string and needed to be processed.

A quick n dirty method is to use grep (or windows grep in this case www.wingrep.com/) to identify the files and generate a list of filenames in plaintext. Then using a quick batch for…loop to process the files from the command line… nice and simple.

for /F "tokens=*" %A in (results.txt) do [command] %A

Substitute [process] for your command. %A contains the filepath from grep. In my case I wanted to just delete the file so I just replaced [command] with del. Done!

TechNet Reference: technet.microsoft.com/en-us/library/bb49…

PlayTerm — Watch the linux guru at work

Posted by & filed under Linux.

PLAYTERM is intended to raise the skills of terminal CLI users, share their skills and inspire others.
PLAYTERM wants to push forward a new way of education, because terminalsessions are language-independent, extremely educative & entertaining.

Basically, PlayTerm lets you ‘look over’ a guru’s shoulder, helping to learn the concept in the video.

It may sound strange, but eventhough CLI stuff sounds like an isolated environment, it is an extremely social playground. Since the eighties, billions of users have helped eachother improving their skills, to get things done faster.
However, there was never a playground for sharing this live, but only peeking over the shoulder of your neighbour (or a *N*X screen -x session).

PLAYTERM wants to restore the actual ‘live’ feeling, which was once established in the BBS scene. There, the BBS’es system operators could ‘takeover’ a users’s session..and show him the way around, or teach him a new programming language.