403Webshell
Server IP : 37.9.174.138  /  Your IP : 216.73.216.117
Web Server : Apache
System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64
User : ftpuser ( 1001)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/doc/rename/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/rename/examples/using-options-code.pl
# examples of using the options HASH from C<File::Rename::Options::GetOptions>
# based on code from "Craig Sanders" <cas@taz.net.au>
# Bug #146138 for File-Rename: how to access options hash in rename script? 
# [rt.cpan.org #146138]
#
# with user code from command line
# 
use strict;
use warnings;
use File::Rename qw(rename);
use File::Basename qw(dirname);
use File::Path qw(make_path);

my $options = File::Rename::Options::GetOptions() or 
    die "Bad options\n";
@ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;

my $expr = delete $options->{_code} or die "No code\n";
my $eval = eval qq( sub { $expr } ) or die $@;

my %seen;
my $code = sub {
    &$eval;
    my $dir = dirname($_);    
    if (! -e $dir) {
      if ($options->{no_action}) {
        print "#mkdir($dir)\n" unless $seen{"$dir"}++;
      } else {
        make_path("$dir", { verbose => 1 });
      };

    } elsif (! -d "$dir") {
      print STDERR "$_: $dir exists but is not a directory!\n";
      return
    }
};

rename(\@ARGV, $code, $options);


Youez - 2016 - github.com/yon3zu
LinuXploit