a few little Perl scripts

rxrename.pl - Interactively rename files using Perl regular expressions

Rename a group of files using regular expressions. The files to be renamed are given as argument to the script. The regular expressions are given interactively, and several may be given. They will be evaluated one after the other.

> rxrename.pl > documentation

redate.pl - Change directory dates to reflect latest content

Recursively resets directory times to the time of the latest file or directory inside.
If no directory is given as argument, processes the current directory.
Works only on NT systems (Windows NT/2000/XP), not on Windows 9x.

> redate.pl > documentation

sendform.cgi - Email web form data

Yet another script to mail the data submited through a web form. It uses hidden form fields for configuration. The email addresses used in the hidden fields can be written with ``_at_'' instead of ``@'', so it is a bit more difficult for email harvesting robots to catch the addresses. The recipient addresses must be registered with the system to avoid spammer abuse.

> sendform.txt > documentation

timezone.pl - Get the current time zone

This is not really a useful script in itself, but I have seen many times the question of how to get the current time zone. This simple sub is what I use in the Mail::Sendmail module, and I suppose it may be useful to incorporate into other scripts.

On some Windows systems in certain particular time zones, a bug in a Microsoft C library may produce wrong results. See Microsoft KB article Q148681. I understand there was also another bug known as the "April's fool bug", for which Google will find you a lot of information.

> timezone.pl

winsntp - Simple Network Time Protocol client for Windows

This Perl script uses SNTP (Simple Network Time Protocol, RFC 2030) to get the time from an NTP server and set the Windows clock.
It can be used interactively or from a scheduler, and can produce output to a log file and/or the Windows NT Event log.
Now that Windows 2000 and XP can use SNTP servers (see NET HELP TIME), it's probably only useful on old NT and 9x systems.

> winsntp.pl > documentation

uptime.pl - Uptime for Windows.

Report machine uptime on Windows systems.
This script attempts to report the system uptime in a format similar to the Unix uptime command. It only reports uptime, not users or load statistics.
On NT it uses the event log. The event log service itself writes an entry to it when it starts (ID 6005).
On Win95 it gets the create time of the system.da0 file (the system.dat backup file which is recreated at system start).
If eihter of these methods fail (like on Win98), it uses the system tick counts. Since these can only hold about 49.7 days, it returns a list of possible uptimes, limited to $max_results (5 by default). (Have you ever seen a Windows system up for more than 200 days? ;-) If yes, set $max_results to a higher value).
The script can be used in CGI. It will print the needed headers automatically.

> uptime.pl > documentation

clip2png, clip2gif - Convert bitmap image from clipboard to png or gif

If you have ImageMagick installed (and Perl of course), you can use this script to quickly convert bitmaps in the clipboard to png or gif files on disk. I generally use this to send small attached files from screen captures (made with PrtSC or Alt-PrtSc).

> clip2png.pl > documentation

v c

Web hosting: almanet.ch