Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello! I need to convert this Perl code into C#. Can you help me?
I'll be very grateful...
PERL
#!/usr/bin/perl
#
# $URL: svn://domestic/54/doc/inf/perl-problems/examples/perl/find.pl $
# $Id: find.pl 516 2010-11-28 18:31:09Z  $
#
use warnings;

sub find($);
sub find($)
{
	my $name=shift;
	if(-d $name)
	{
		my $dir;
		unless(opendir $dir, $name)
		{
			warn "$0: Impossible to open «$name»: $!\n";
			return;
		}
		print "$name\n";
		$name='' if $name eq '/';
		for(readdir $dir)
		{
			next if $_ eq '.' or $_ eq '..';
			find("$name/$_");
		}
		closedir $dir;
	}
	elsif(-f $name)
	{
		print "$name\n";
	}
	else
	{
		warn "$0: «$name»: $!\n";
	}
}

find($_) for @ARGV;
find('.') unless @ARGV;
Posted
Updated 14-Jun-12 8:44am
v2
Comments
Zoltán Zörgő 14-Jun-12 16:27pm    
What exactly should this do?
Sandeep Mewara 14-Jun-12 16:36pm    
What kind of help? What have your tried? Where are you stuck?
Michael Rokosh 14-Jun-12 17:41pm    
This code should search duplicate files in directories.
barneyman 14-Jun-12 21:07pm    
that's not what that find function does; it's simply a recursive file lister

1 solution

check this[^] out may be helpful

This also[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900