Bulk Rename Files in Bash
Posted by jason on Jan. 30, 2013, 6:12 a.m.
Let's say I have a set of files that all have the same thing wrong with the filename.
$ ls -1 *.ext
badname.other.stuff1.ext
badname.other.stuff2.ext
badname.other.stuff3.ext
I can substitute "badname" with "goodname" for all the files with the following command:
for i ...
Linux command line: recursively find all files with a given string
Posted by jason on Nov. 4, 2011, 6:25 a.m.
Here's a little script I wrote that I install on any linux server that I do any programming on:
#!/bin/sh
find . -type f -iregex '.*\.\(php\|html\|js\|css\|py\|lua\)$' -print0 | xargs -0 grep -n -i -H "$1"
Note that this searches all .php, .html, .js, .css, .py ...
Bash scripting: rename upper case file extensions to lower case
Posted by jason on Oct. 25, 2011, 10:18 p.m.
I recently had one of my quick-and-dirty bash scripts broken because I wasn't expecting to receive a bunch of files named *.JPG as opposed to *.jpg. "Yay! I get to improve my bash script!" I thought to myself. Here's a script that will look at the files in ...