SkellySoul Posted August 30, 2010 Share Posted August 30, 2010 (edited) Hello I made this script because I have many movies and they get self-extracted once they have finished downloading and they get put into a folder and the rar , movie and subtitles files all get mixed into one folder. This can be very hard to figure what I need and don't need. So this script finds some of the common movie types and subtitles and moves them all into a different folder and save that mess in the other folder for later. Global $FileTypes[4] $FileTypes[0] = "Srt" $FileTypes[1] = "Avi" $FileTypes[2] = "Mp4" $FileTypes[3] = "Mkv" $Search = FileFindFirstFile("*.*") If $Search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $File = FileFindNextFile($Search) If @Error Then ExitLoop Else $i = 0 Do If StringTrimLeft($File , StringLen($File) -3) = $FileTypes[$i] Then FileMove(@ScriptDir & "\" & $File , @ScriptDir & "\Other\" & $File) EndIf $i +=1 Until $i = 4 Or @Error EndIf WEnd FileClose($Search) Yes, This is hard to explain. (people who use "Jdownloader" probably know what I am talking about) Edited August 30, 2010 by SkellySoul Link to comment Share on other sites More sharing options...
wakillon Posted August 31, 2010 Share Posted August 31, 2010 (edited) I try to simplify... Global $FileTypes[5]=[4,'Srt','Avi','Mp4','Mkv'] $Search = FileFindFirstFile ( "*.*" ) If $Search = -1 Then Exit MsgBox ( 0, "Error", "No files/directories matched the search pattern" ) While 1 $File = FileFindNextFile ( $Search ) If Not @Error Then $_Ext = _GetExt ( $File ) For $_I = 1 To UBound ( $FileTypes ) -1 If $FileTypes[$_I] = String ( $_Ext ) Then _ FileMove ( @ScriptDir & "\" & $File , @ScriptDir & '\Other\' & $File, 9 ) Next Else FileClose ( $Search ) ExitLoop EndIf WEnd Func _GetExt ( $_FileName ) $_FileName = StringSplit ( $_FileName, '.' ) If Not @error Then Return $_FileName[$_FileName[0]] Else Return 0 EndIf EndFunc ;==> _GetExt ( ) Edited August 31, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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