Adriano Allora
2006-06-30 14:48:09 UTC
hi to all,
does exists a way to rename automatically files?
I mean: I've got directories with this content:
EN0.tmp
EN1.tmp
EN2.tmp
EN3.tmp
EN4.tmp
...
IT0.tmp
IT1.tmp
IT2.tmp
IT3.tmp
IT4.tmp
...
Now, some couples of files were deleted (you can imagine the
EN1.tmp/IT1.tmp) but I need no holes in my list.
Is there something less rude (and more general) than
$c = 0;
while(<>)
{
if($ARGV=~/^([A-Z]+)(\d+)\.tmp/)
{
$nuname = $1.$c.'.tmp';
`mv $ARGV $nuname';
$c++;
}
}
Thanks at all,
alladr
|^|_|^|_|^| |^|_|^|_|^|
| | | |
| | | |
| |*\_/*\_/*\_/*\_/*\_/* | |
| |
| |
| |
| http://www.e-allora.net |
| |
| |
**************************************
does exists a way to rename automatically files?
I mean: I've got directories with this content:
EN0.tmp
EN1.tmp
EN2.tmp
EN3.tmp
EN4.tmp
...
IT0.tmp
IT1.tmp
IT2.tmp
IT3.tmp
IT4.tmp
...
Now, some couples of files were deleted (you can imagine the
EN1.tmp/IT1.tmp) but I need no holes in my list.
Is there something less rude (and more general) than
$c = 0;
while(<>)
{
if($ARGV=~/^([A-Z]+)(\d+)\.tmp/)
{
$nuname = $1.$c.'.tmp';
`mv $ARGV $nuname';
$c++;
}
}
Thanks at all,
alladr
|^|_|^|_|^| |^|_|^|_|^|
| | | |
| | | |
| |*\_/*\_/*\_/*\_/*\_/* | |
| |
| |
| |
| http://www.e-allora.net |
| |
| |
**************************************
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>