Kombination find und xargs

Das folgende Konstrukt funktioniert mit den GNU Versionen von xargs, mv und find, so wie es die meisten Linuxdistributionen mitbringen.

Manchmal hat man über mehrere Verzeichnisse verteilt gleichartige Dateien, die man in einen gemeinsamen Ordner bringen möchte. Händisch geht das natürlich, das kann aber auch unübersichtlich werden. Eine geschickte Verkettung von  vorhandenen Kommandos erleichtert dem Anwender dabei das Leben.

find . -name "*.mobi" -print0 | xargs -r0 mv -t ~/tmp/

Das find-Kommando sucht die Dateien mit dem genannten Muster ab dem aktuellen Verzeichnis.

Das xargs-Kommando führt dann für jede gefundene Datei den mv-Befehl aus. Hier wird über die -t Option ein GNU-spezifisches Feature aktiviert, bei dem immer zuserst das Zielverzeichnis angegeben wird. Die zusätzlichen Optionen bei find und xargs  sorgen für korrektes Quoting der Dateinamen, wenn Leer- und Sonderzeichen enthalten sind.

Ein praktisches Beispiel sähe wie folgt aus:

Find ergibt folgendes Resultat:

./a/a.mobi
./b/b.mobi

xargs führt folgende Kommandozeilen aus:

mv -t ~/tmp/ ./a/a.mobi
mv -t ~/tmp/ ./b/b.mobi

Helper scripts for Buffalo LinkStation

Buffalo LinkStation Mini (illustration only)
Buffalo LinkStation Mini (illustration only)

Some years ago I purchased a Buffalo LinkStation Mini, a small NAS device for backup purposes. This device works quite well but until today, I didn’t have access to the builtin Wake-on-LAN feature from Linux.

Under Windows, the NAS boots as soon as the PC side software issues a special start request. After a little internet search, I found the necessary information and a small bash script to achieve this under Linux. I have adapted the wakeup script a bit and added a feature to disable the wakeup request via a second script. A third script queries the status of the NAS, both on the network and the state of the local wakeup script.

The wakeup script is intended to be run from the user’s Autostart sequence. The helpers can be called when needed.

Some icons are included.

The script needs bash,. zenity, notify-send and wakeonlan. The latter is a Ubuntu package and should be available in your distro as well.

The MIT License applies to this software. It works for my Buffalo LinkStation Mini, maybe for others too  but I cannot guarantee this. You are on your own but, hey, the software is free for modification :)

Download scripts and icons (86K)

Original script and information:  http://www.stqu.de/joomla/index.php/tutorials/16-linux/60-buffalo-linkstation-einschalten-via-wol

Gopher Test Project

This is our Gopher Test Project. It concludes my research concerning this vintage hypertext protocol. It included the development of an experimental server.

Resources

Outdated as of October 18th 2007.

Experimental Gopher server in bash

This is our first implementation of the Gopher protocol. It is written in Bash. It needs some tweaking. It should be run from inetd. No more instructions provided – see the code for details.
Download (7.7 K)

Tools & Utilities

Tree Utility

This is the little tree utility published in the Linux Gazette.
Download (9.3 K)

Maintenance Mailer

This is a small utility to create a report mail out of the sys logs.
A shell script for BASH.
Download (9.8 K)

Makemenu

This perl script creates and index of HTML files. Not by ASM Software but packaged by us.
Download (4.4 K)

mp3convert

mp3convert is a small shell script.
Its purpose is to convert whole Audio CDs into mp3 files.
The programs cdda2wav and bladeenc are required for proper operation.
Download (1.9 K)