Search
 
SCRIPT & CODE EXAMPLE
 

PERL

Move files to new directory

foreach my $file (@files) 
{
    my $old = "$srcdir/$file";
    my $new = "$dest/$file";
    my $subdir = $file;
    while (length($subdir)>0)
    {
        if (-d "$dest/$subdir")
        {
            $new = "$dest/$subdir/$file";
            last;
        }
        chop($subdir);
    }

    rename($old, $new) or die "Move $old -> $dest failed: $!";
}
Comment

PREVIOUS NEXT
Code Example
Perl :: Perl (perl 5.28.1) sample 
Perl :: perl 6 
Perl :: perl rename a file 
Perl :: first line perl 
Pascal :: wait for input in pascal 
Pascal :: pascal sleep 
Pascal :: pascal cheat sheet pdf 
Powershell :: disable defender powershell 
Powershell :: get-childitem supress errors silently 
Gdscript :: godot get scene root 
Gdscript :: godot print enum name 
Abap :: abap data conversion 
Erlang :: tcp client erlang 
Assembly :: havong space between lines of richtext in flutter 
Assembly :: where correlation is used 
Assembly :: irate translator 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: map range of numbers to another range 
Javascript :: jest cache clear 
Javascript :: javascript replace spaces with dashes 
Javascript :: import redux thunk 
Javascript :: jquery refresh page 
Javascript :: delete session javascript 
Javascript :: get week day name in javascript 
Javascript :: how to remove checked attribute of checkbox in jquery 
Javascript :: loop array backwards javascript 
Javascript :: generate random whole numbers within a range javascript 
Javascript :: jquery remove and add class 
Javascript :: how to use another port in angular 
Javascript :: How to get current URL with Javascript or React 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =