Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: Help wanted: script to convert /video1 to /video01
On Tue, 30 Mar 2004 11:44:58 +0200, Axel Gruber <axelgruber3@gmx.de>
wrote:
> Perhaps anyone here can help me writing a Script to convert all
> symbolic-Links in /video0 to "double-Numbers".
Try this:
#!/usr/bin/perl
#
# written by Emil.Naepflein@philosys.de
#
# Use this tool on your own risk!
use File::Find ();
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
File::Find::finddepth({wanted => \&renamelinks}, "/video0/");
exit;
sub renamelinks {
if (-l $_) {
$link = $newlink = readlink($_);
$newlink =~ s#/video(\d)#/video0$1#;
printf("%s -> %s renaming to %s\n", $name, $link, $newlink);
unlink($name);
symlink($newlink, $name);
}
}
--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.
Home |
Main Index |
Thread Index