#!usr/bin/perl
#directory.plx

my @list;

use File::Copy;
use Cwd 'abs_path';
my $current_dir=getcwd;

opendir IN, "." or die "Can't find directory $dir: $!\n";

while ($_ = readdir(IN)){
	next if $_ eq "." or $_ eq "..";
	$full_path=abs_path($_);
	print $full_path, " " x (30-length($_));
 	print "d" if -d $_ ;
	if (!-d $_){
	print "Not Directory";
	#push @list,$_;
	$list[++$#list]=$full_path;
	move($_,"/home/Lance/perl1/double/Duplicates/".$_) or die "Move Failed Here: $!";
	}
	print "r" if -r $_ ;
	print "w" if -w $_;
	print "x" if -x $_;
	print "o" if -o $_;
	print "\t\t";
	print -s if -r $_ and -f $_;
	print "\n";
}

@sorted_list=sort @list;

#print @list;

foreach (@list){
	print "$_\n";
}


foreach (@sorted_list){
	print "$_\n";
	move($_,"/home/".$_."second") or die "Move failed: $!";

	#copy("$_","/home/Lance/perl1/doubles/".$_."second") or die "Copy Failed: $!";
	#rename "$_", "./Duplicates".$_."second";
	#link "$_",".\Duplicates".$_."second";
	}
