hydrael Posted September 16, 2009 Share Posted September 16, 2009 first of all sorry for my english, and sorry i am not very specific for my tries, but i can barely write in english. Here is the situation I am trying to sort my ebooks collection which is like, 50000 files in the same folder. Their filename is like that Author_book title " what i want is to make a script that checks the filename and takes the "Author" part of the filename and moves the file in a folder name "Author"" i believe i can do that using a filelist, a txt, and a million "send keystrokes" to create a bat file that does that. I have done something similar in the past, in a similar situation, but this is probably the most inefficient way possible. Can anyone help me? Only coding experience i have is some C. Link to comment Share on other sites More sharing options...
ctyankeeinok Posted September 16, 2009 Share Posted September 16, 2009 (edited) Look at _FileListToArray in the Help. It reads the contents of a directory. From there you can use DirCreate, FileCopy/FileMove. Forget about sending keystrokes. Also look at StringInStr to find the location of the underscore (the end of the author name). Spend some time in the Help files and I think you will find you will be able to complete your task with AutoIT without sending bunches of keystrokes.. Read files Extract Autor for first file Look for directory for the Author - create teh directory if needed Move all files for the author using wildcard Something like that... Edited September 16, 2009 by ctyankeeinok Link to comment Share on other sites More sharing options...
hydrael Posted September 16, 2009 Author Share Posted September 16, 2009 Thanks a lot for the fast response. now that i know the correct functions i will try to make it... Link to comment Share on other sites More sharing options...
hydrael Posted September 18, 2009 Author Share Posted September 18, 2009 Made it, Thanks again #Include <File.au3> #Include <Array.au3> Dim $var1 $FileList=_FileListToArray(@WorkingDir) _ArrayDisplay($FileList,"$FileList") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf For $1=1 to $filelist[0] step 1 $var1=StringInStr($FileList[$1]," - ")-1 $path=stringleft($FileList[$1],$var1) $file=$FileList[$1] Filemove(@WorkingDir & "\" & $file, @WorkingDir &"\"& $path & "\", 9) Next Link to comment Share on other sites More sharing options...
Rishav Posted September 18, 2009 Share Posted September 18, 2009 Nice work. short to the point code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now