All pastes #423433 Raw Edit

Zach

public text v1 · immutable
·published 2007-04-04 04:33 UTC
rendered paste body
#!/usr/bin/perl
# Simple File Allocater (Not Finished)
# For use in Console
sub create_list{
 my $shift=shift;
 my @var=`ls $shift`;
 our @list;
 my $loop=0;
 foreach $mp3(@var) {
  chomp($mp3);
  @list[$loop]=$mp3;
  print $loop."."." ".@list[$loop]."\n";
  $loop++;
 }
}
print "Directory: ";
my $dir=<STDIN>;
create_list($dir);
sub get_song{
 our @get;
 my $loop=0;
 do{
  print "#".$loop." ";
  $cin=<STDIN>;
  if($cin!="done"){@get[$loop]=@list[$cin];}
  $loop++;
 }while($cin!="done");
}
get_song;
$getnum=$#get+1;
`clear`;print"\n:::::::::MP3s to allocate:::::::::\n";
my $loop=0;while(@get[$loop]){print@get[$loop]."\n\n";$loop++;}<STDIN>;
sub teh_creation{
 my $shift=shift;
 `mkdir $shift`;
 my $loop=0;
 while(@get[$loop]){
 my$var=@get[$loop];
 `mv "/home/zach/Desktop/MP3/$var" $shift`;
  $loop++;
 }
}
print "New Directory: ";
my $newdir=<STDIN>;
teh_creation($newdir);
  

# My third Perl program ever