Thread Einen Ordner suchen (11 answers)
Opened by Xertno at 2012-06-20 10:13

Linuxer
 2012-06-20 10:35
#159227 #159227
User since
2006-01-27
3872 Artikel
HausmeisterIn

user image
Schneller Hack:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/perl
use strict;
use warnings;

use feature qw(say);
use File::Find;
use Cwd;

my $name    = shift;
my $basedir = shift;

exit 1              unless defined $name;
$basedir = getcwd   unless defined $basedir;

die "'$basedir' is not a directory.\n"  unless -d $basedir;

# print full path if it is a directory and the last part matches $name
find( sub { say $File::Find::name  if -d $File::Find::name && $_ eq $name }, $basedir );
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread Einen Ordner suchen