diff options
author | robiscool <robrob2626@yahoo.com> | 2012-06-13 16:51:54 -0700 |
---|---|---|
committer | robiscool <robrob2626@yahoo.com> | 2012-06-13 16:51:54 -0700 |
commit | ea6c2fadb8745f14d7fb1fb23eaab85df1db2a7b (patch) | |
tree | 9f5a0fc5bba758a454dba65cd1c93c6b93d2c1fb /config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl | |
parent | b72bc9fafe78cd4d0a53b230eb71134e4c0575ea (diff) | |
download | pfsense-packages-ea6c2fadb8745f14d7fb1fb23eaab85df1db2a7b.tar.gz pfsense-packages-ea6c2fadb8745f14d7fb1fb23eaab85df1db2a7b.tar.bz2 pfsense-packages-ea6c2fadb8745f14d7fb1fb23eaab85df1db2a7b.zip |
snort-dev, move snort-dev2 to snort-dev
Diffstat (limited to 'config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl')
-rw-r--r-- | config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl b/config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl deleted file mode 100644 index e5f0d39e..00000000 --- a/config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/perl -w - -#usage: rename perl_expression [files] -my $usage = qq{rename [-v] s/pat/repl/ [filenames...]\t (c)2001 hellweg\@snark.de -rename files read from the commandline or stdin - -License to use, modify and redistribute granted to each and every lifeform on -this planet (as long as credit to hellweg\@snark.de remains). No guarantee that -'rename' does or does not perform the way you want... - -} ; -$verbose = 0 ; -$quiet = 0 ; - -$op=shift || 0 ; -if($op eq "-v") { - $verbose++ ; $quiet = 0 ; - $op=shift || 0 ; -} -if($op eq "-q") { - $quiet++ ; $verbose = 0 ; - $op=shift || 0 ; -} -if($op =~ /^-h/) { - print $usage; exit(0) ; -} - -if(! $op) { - print $usage; exit(-1) ; -} - -if (!@ARGV) { - @ARGV = <STDIN>; -} - -$count=0 ; -my($m, $d, $y, $T) ; -for (@ARGV) { - chomp ; - if(-e $_) { - $was = $_; - if($op =~ /\$[Tdym]/) { - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime((stat($_))[9]); - $m = sprintf("%0.2i", $mon+1); - $d = sprintf("%0.2i", $mday); - $y = $year + 1900 ; - $T = "$y$m$d" ; - } - eval $op; - die $@ if $@; - if(-f $_) { print("! exists already: $was -> $_ \n") unless $quiet ; } - else { - if(rename($was, $_)) { - print("$was -> $_\n") if $verbose ; - $count++; - } else { - if(/\//) { - # maybe we need to create dirs? - my $createRes = createDirs($_) ; - if($createRes) { - print("! fauled to create $createRes for $_\n") - unless $quiet ; - } - else { # try again - if(rename($was, $_)) { - print("$was -> $_\n") if $verbose ; - $count++; - } else { - print("! failed to rename $was -> $_ \n") - unless $quiet ; - } - } - } - else { - print("! failed to rename $was -> $_ \n") unless $quiet ; - } - } - } - } - else { print("! not found: $_ \n") ; } -} -print("renamed $count files\n") if $verbose ; - - -sub createDirs { # return the dir we failed to create or 0 - my $file = shift ; - my @dirs = split /\//, $file ; - pop @dirs ; # don't try to mkdir the file itself - my $current = "" ; - $current = "/" if ($file =~ /^\//) ; - foreach (@dirs) { - $current .= $_ ; - if(! -d $current) { - mkdir $current, 0700 || return $current ; - print "mkdir $current\n" if ($verbose) ; - } - $current .= "/" ; - } - return 0 ; # success -} |