--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+for my $fname_old ( @ARGV ) {
+
+ my ( $base, $day, $time, $ext );
+ if ( ( $base, $day, $time, $ext ) = $fname_old =~ /^(.*)\.(\d\d\d\d-\d\d-\d\d)[\-_](\d\d-\d\d-\d\d)(\..*)?$/ ) {
+ $ext ||= '';
+ print $base . $ext . '.' . $day . '_' . $time . "\n";
+ }
+ else {
+ print $fname_old . "\n";
+ }
+
+}
+++ /dev/null
-#!/bin/sh
-
-# $Id$
-# $URL$
-
-# set -x
-
-if [ -x /usr/local/bin/date ] ; then
- DATE=/usr/local/bin/date
-elif [ -x /usr/local/gnu-bin/date ] ; then
- DATE=/usr/local/gnu-bin/date
-else
- echo "GNU-Date nicht gefunden!" >&2
- exit 10;
-fi
-
-OIHF="$IFH"
-IFH="
-"
-
-#set -x
-
-if [ "$#" = "0" ] ; then
- echo "Keine Dateien angegeben, verwende statt dessen '.'."
- #FILES="."
- set "."
-#else
- #FILES=$@
-fi
-
-if [ "${OLD_DIR}" = "" ] ; then
- OLD_DIR=".old"
-fi
-
-#---------------------------------------------
-
-perform_file() {
-
- F="$1"
-
- if [ ! -f "$F" ] ; then
- return
- fi
- FILEDIR=`dirname "$F"`
- FOLDDIR="${FILEDIR}/${OLD_DIR}"
-
- if [ ! -d "${FOLDDIR}" ] ; then
- echo "Erstelle Verzeichnis '${FOLDDIR}' ..."
- mkdir "${FOLDDIR}" || exit 2
- fi
-
- n="${FOLDDIR}/`basename ${F}`.`$DATE -r \"${F}\" '+%Y-%m-%d_%H-%M-%S'`"
- echo " - '${F}' -> '$n'"
- cp -p "${F}" "${n}"
-
-}
-
-#---------------------------------------------
-
-perform_dir() {
-
- D="$1"
-
- echo "Sichere Verzeichnis '${D}' ..."
- # sleep 1
-
- for NODE in `ls -1 -d "${D}"/* "${D}"/.* 2>/dev/null` ; do
-
- # echo "Untersuche Node '${NODE}' ..."
- BASENAME=`basename "${NODE}"`
- # echo "Basename: '${BASENAME}'"
- # sleep 1
-
- SKIP=0
-
- if [ "${BASENAME}" = "." ] ; then
- SKIP=1
- fi
-
- if [ "${BASENAME}" = ".." ] ; then
- SKIP=1
- fi
-
- if [ "${BASENAME}" = "${OLD_DIR}" ] ; then
- SKIP=1
- fi
-
- if [ -L "${NODE}" ] ; then
- SKIP=1
- fi
-
- if [ "${SKIP}" = "0" ] ; then
-
- if [ -d "${NODE}" ] ; then
- perform_dir "${NODE}"
- elif [ -f "${NODE}" ] ; then
- perform_file "${NODE}"
- fi
-
- fi
-
- done
-
-}
-
-#---------------------------------------------
-
-perform_node() {
-
- N="$1"
-
- if [ -L "$N" ] ; then
- return
- fi
-
- if [ -d "$N" ] ; then
- perform_dir "$N"
- return
- fi
-
- if [ -f "$N" ] ; then
- perform_file "$N"
- fi
-
-}
-
-while [ "$#" != "0" ] ; do
- perform_node "$1"
- shift
-done
-
-IHF="${OIFH}"
-
-exit 0
-
-#---------------------------------------------
-