Scripting

Recursively symlinking files

This is a short script I use to symlink all my JPG image files on my file server to a flat folder accessible to my DLNA enabled devices. My files are organized in year folders and under each year there are month folders: -2011 –2011-01 –2011-02 –2011-03 … -2012 –2012-01 I avoid duplicate symlinks by […]

Read More
Scripting

Rename files in a folder to lower-case using perl

This is a simple oneliner to rename files to lower-case using perl # perl -e ‘rename($_, lc) || warn “$_: $!\n” for @ARGV’ * You can also do this recusively using find and perl # find . -type f -exec perl -e ‘rename($_, lc) || warn “$_: $!\n” for @ARGV’ {} \;

Read More
Linux

Grep recursively through subdirectories

grep recursively through subdirectories for files that match a specific pattern: grep -l -r –include=*.doc regex * The equivalent command unsing find: find . -name ‘*.doc’ -exec grep -l regex \{\} \; The option after grep is the lowercase letter L, not the number 1). Remove the -l to see the actual matches instead of […]

Read More