#!/usr/bin/perl # # Copyright (c) 2009 by FlashCode # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # # Rename WeeChat old log files (WeeChat <= 0.2.6.x) to new names # (for WeeChat >= 0.3.x) # # This must be run in ~/.weechat/logs directory. # # WARNINGS: # 1. no check about current directory, be sure to run this script in logs # directory, from weechat 0.2.6 (with no log from devel) # 2. new log names are default names in version 0.3.0 (it can be changed) # # (c) 2009-05-17 by FlashCode # @files = <*>; foreach $file (@files) { if ($file =~ /weechatlog$/) { if ($file eq "weechatlog") { $new_name = "core.weechat.weechatlog"; } else { if ($file =~ /^([^\.]+)\.weechatlog$/) { $new_name = lc("irc.server.$1.weechatlog"); } else { $new_name = lc("irc.$file"); } } print "rename: $file to $new_name\n"; rename($file, $new_name); } }