"Brian E. Lavender" <[email protected]> writes:
> Shell command that does the following.
>
> rename "s/^/foo/" *.txt
I think I posted it a long time ago. It was written before the command
line rename program existed, so there wasn't a conflict.
#!/usr/bin/perl
($op = shift) || die "Usage: rename expr [files]]\n";
if(!@ARGV)
{
@ARGV = <STDIN>;
chop(@ARGV);
}
for (@ARGV)
{
$was = $_;
eval $op;
die $@ if $@;
if ($was ne $_)
{
print "rename($was,$_)\n";
rename($was,$_);
}
}
exit;
--
Wes Hardaker
My Pictures: http://capturedonearth.com/
My Thoughts: http://pontifications.hardakers.net/
_______________________________________________
vox-tech mailing list
[email protected]
http://lists.lugod.org/mailman/listinfo/vox-tech