Alexander, this is my current code: (after I changed what I told you in my previous message, and it did not change anything)
#!/usr/bin/perl -w use File::Copy; use warnings; $dir="C:/Users/Beni/Documents/Master 2/_DOSSIERS/_Perl/dossiertest"; $cpt=0; print"Souhaitez-vous supprimer les fichiers copies du dossier racine u +ne fois la copie terminee ? (oui/non) : "; chomp ($del = <>); opendir(DIR,$dir) or die $! ; while($folder=readdir (DIR)) { if ( -f "$dir/$folder") { $folder =~m/(.+)?\.(.+)?/; if ( -d "$dir/Fichiers $2") { copy ("$folder","$dir/Fichiers $2/$folder"); } else { $dirr = $dir . '/' . "Fichiers " . $2; mkdir ("$dirr"); copy ("$folder","$dir/Fichiers $2") or die $! ; } $cpt++; if ($del=~m/^oui$/i) { unlink ("$dir/$folder") or die $! ; } } } print"$cpt copies effectuees"; close (DIR);
In reply to Re^4: Perl - Copy files to a newly created folder
by Benichouniev
in thread Perl - Copy files to a newly created folder
by Benichouniev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |