#!/usr/bin/perl -w ######################################################### # YUKI LOVE v1.0 # # Yuki love is an organizational program # # For 4chan images. It uses a tagging system # # To place images in the proper directories # # as defined by the user. The tags will be # # appended to a downloaded file by the user # # and that tag will indicate where the file is # # to be saved. This program can be run with the # # --setup argument to set all associations for # # the tags it will recognize. # # # # Here is an example: # # 122546788980yu.jpg would be sorted in: # # HaruhiSuzumiya/Yuki, in my case, since # # I set the association yu = Yuki # # This way the user controls where images go # # without having to directly place them there. # # It is recommended that this script be run in a # # cron process, or simply when you feel like # # cleaning up your home folder. This program # # will create the directories from scratch and # # will NOT replace your current images. # # # # bugs and issues should be reported to: # # ayukiforyou@gmail.com # # -YUKI.NAGATO- # ######################################################### use Getopt::Long; my $setup; GetOptions("setup"=>\$setup); if($setup){ print "\n\n"; print "Hello and welcome to YukiLove! Here we are\n"; print "Going to get you setup! Where will we make the\n"; print "Main directory? (Type full path, including the new directory name, no slash!)\n"; my $main_directory = ; chomp($main_directory); print "Remember to escape spaces!! e.x 'Haruhi Suzumiya' should be type 'Haruhi\ Suzumiya'\n"; print "Now, type the series you want in this directory followed by the enter, no slash!\n"; print "Type STOP to finish.\n"; while(1){ my $sub_ = ; chomp $sub_; if($sub_ eq "STOP" || $sub_ eq "stop"){ print "-------SAVED--------\n"; last; } else { print "What subcategories go in: ", $sub_, "? STOP to Finish.\n"; while($sub_ ne "STOP" || $sub_ ne "stop"){ my $subsub = ; chomp $subsub; if($subsub eq "STOP" || $subsub eq "stop"){ print "You have stopped entering sub categories for: ", $sub_, " please proceed to the\n"; print "next series. Remember to type STOP to Finish entering series.\n"; last; } else { system("mkdir -p $main_directory/" . "$sub_/" . "$subsub/"); } } } } print "Now we're going to set your associations. These are what the program will read\n"; print "When organizing your files. Do it in this form:\n"; print "Folder_name=association. Example: Yuki\ Nagato=yu\n"; print "These will be stored in a file called associations.txt. To add more at a later date simply edit\n"; print "The file. You can have as many associations as you have directories.\n"; print "Once again, STOP cancels input.\n"; system("touch associations.txt"); open FILE, ">>associations.txt" or die $!; while(1){ my $assoc = ; chomp $assoc; if($assoc eq "STOP" || $assoc eq "stop"){ print "File written.\n"; last; } else { print FILE $assoc . "\n"; } } print "Setup complete! To run type ./YukiLove.pl or perl YukiLove.pl with no arguments.\n"; } else { open FILE, "; $file_len = @file; for($i=0; $i<$file_len; $i++){ @folder[$i] = @file[$i] =~ /(.*)=/; @assoc[$i] = @file[$i] =~ /=(.*)/; system("find ~ -name @folder[$i] -exec mv *@assoc[$i]* {} >>output.txt " . '\; '); } }