Scripting

One-line batch file renamer

If you want to batch rename a bunch of files (say “foo*.jpg” to “bar*.jpg”), you might think you could just do “mv foo*.jpg bar*.jpg” in the Terminal. However, this doesn’t work right since the shell expands each argument before the execution occurs. However, there’s a cool way to accomplish the same result with a (more […]

Read More
Linux

Shell scripts for archiving digital photos in directories by month

This is my version of the shell script “Shell scripts for archiving digital photos in directories by date“. It utilizes  the exiftags command available in most linux distributions like Gentoo and debian Linux. Though the metacam program is also usefull since it can read Nikon NEF-files.Here’s an example of a directory tree they create: 2006 […]

Read More
Scripting

Shell scripts for archiving digital photos in directories by date

The fact that most digital cameras store the shooting dates inside JPEG files in the EXIF format makes it possible to automatically archive the photos by date right after they are downloaded, which is exactly what the scripts below do. Here’s an example of a directory tree they create: 1999 1999-07 1999-07-14 IMG_48324.JPG IMG_48325.JPG IMG_48326.JPG […]

Read More
Scripting

Shell script for removing duplicate files

The following shell script finds duplicate (2 or more identical) files and outputs a new shell script containing commented-out rm statements for deleting them. You then have to edit the file to select which files to keep – the script can’t safely do it automatically! OUTF=rem-duplicates.sh; echo “#! /bin/sh” > $OUTF; find “$@” -type f […]

Read More
Security

Rule-based DoS attacks prevention shell script

Dette scriptet er ikke testet samt DoS bør hindres på kernel nivå! A simple rule-based DoS attack-prevention shell script. However, the proposed shell script is not a perfect tool for preventing DoS attacks, but a powerful tool for alleviating DoS attacks overheads of the Linux servers significantly.

Read More