All pastes #398513 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-17 08:55 UTC
rendered paste body
#!E:/Perl/bin/perl.exe -w
use strict;
use File::Copy;
&welcome_msg();
print "\n\nPlease Enter Working Dir : ";
while(<>)
{
	chomp;
	my $dir = $_;
	if(!chdir($dir))
	{
	  print "Error :$!\n";
	} else
	{
	 chdir($dir);
	 print "Files? : ";
	 my @a = glob <STDIN>;
	 my $array_num=@a;
	 print "Please enter a folder name : ";
	 my $f_in = <STDIN>;
	 chomp($f_in);
	 if(!-e $f_in)
	 {
		mkdir($f_in);
	 }
	   for(my $i=0;$i<$array_num;$i++)
	   {
	   	 my $shifter = shift(@a);
		 move($shifter,$f_in);
	 	 print "\n$shifter moved to $f_in";
	   }
	 print "\nPlease choose another dir or cntrl+c : ";
	}
}

sub welcome_msg()
{
	print "\n\nYou've Decided to run $0 which was written by\n";
	print "Gnomer/PaTcH. The working are simple, but there\n";
	print "are things you should know. If the file name has spaces\n";
	print "then it will NOT sort the file. That will be fixed when I release\n";
	print "this for the public. If no folder exist, it makes the name\n";
	print "you specify.\n\n\n\tThank you, PaTcH/Gnomer\n";
}