3 #===============================================================
5 # File ID: f7f4047c-5d36-11df-a766-90e6ba3022ac
6 # Leser filnavn fra stdin og skifter navn på dem fra gammelt
7 # afv-format (epoch) til ååååmmddTttmmssZ . Virker forsåvidt på
8 # alle filer som begynner med et 9- eller 10-sifret nummer.
10 # Character set: UTF-8
11 # License: GNU General Public License version 2 or later
12 # ©opyleft 2004 Øyvind A. Holm <sunny@sunbase.org>
13 #===============================================================
27 if (/^(.*)\/([^\
/]+?)$/) {
31 if ($File =~ /^(.*?)\b(\d{9,10})\b(.*)$/) {
32 my ($First, $Num, $Rest) =
34 my $From = "$Path/$File";
36 my @TA = gmtime($Num);
37 my $date_str = sprintf("%04u%02u%02uT%02u%02u%02uZ", $TA[5]+1900, $TA[4]+1, $TA[3], $TA[2], $TA[1], $TA[0]);
38 my $Dest = "$Path/$First$date_str$Rest";
40 if (rename($From, $Dest)) {
41 $opt_v && print("$From → $Dest\n");
43 warn("rename(\"$From\", \"$Dest\"): $!\n");
46 warn("$Dest: File exists.\n");
49 warn("Ignoring non-regular file $From\n");
61 This program is free software; you can redistribute it and/or modify it
62 under the terms of the GNU General Public License as published by the
63 Free Software Foundation; either version 2 of the License, or (at your
64 option) any later version.
66 This program is distributed in the hope that it will be useful, but
67 WITHOUT ANY WARRANTY; without even the implied warranty of
68 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
69 See the GNU General Public License for more details.
71 You should have received a copy of the GNU General Public License along
72 with this program; if not, write to the Free Software Foundation, Inc.,
73 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
77 # vim: set fileencoding=UTF-8 filetype=perl foldmethod=marker foldlevel=0 :
78 # End of file afv_rename