SimJ Posted March 14, 2008 Share Posted March 14, 2008 Hello all, This may be a simple, one, but i've done some research and haven't found anything yet... I'd like to select a batch of 1000 files from a specific directory and cut those files and paste them into a different directory. I dont need specific file names, i just need to process 1000 files at a time. Does anyone have any idea how to do this? Any help is very much appreciated. Please note: I don't want to use a loop if possible. Thanks! SimJ Link to comment Share on other sites More sharing options...
martin Posted March 14, 2008 Share Posted March 14, 2008 Hello all,This may be a simple, one, but i've done some research and haven't found anything yet... I'd like to select a batch of 1000 files from a specific directory and cut those files and paste them into a different directory. I dont need specific file names, i just need to process 1000 files at a time. Does anyone have any idea how to do this? Any help is very much appreciated.Please note: I don't want to use a loop if possible.Thanks!SimJIf you want to copy a set number of files, such as 1000, at a time then it's dificult to see how you can avoid using a loop.You can copy all the files in one line with DirCopy. Why do you only want to copy 1000 at a time? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
cal Posted March 16, 2008 Share Posted March 16, 2008 Why a 1000 at a time? Cut and Paste? Just use Autoit to move them directly. Wildcards are supported. I'm guessing you have some other program that will choke if it sees more the 1000 files in your destination dir. If so then use _FileListToArray to put your list into an array and then loop though it moving your 1000 and then pausing for whatever else you have going on before continuing with the next 1000. And this is perfect for a loop. Any reason not to use one? Link to comment Share on other sites More sharing options...
JustinReno Posted March 16, 2008 Share Posted March 16, 2008 (edited) Without a loop it isn't possible: Global $Directory = @ScriptDir Global $MoveDirectory = @ScriptDir & "\Batch Files" $GetBatchFiles = _FileListToArray($Directory, "*.bat") If $GetBatchFiles[0] >= 1000 Then For $I = 1 To 1000 FileMove($Directory & "\" & $GetBatchFiles[$I], $MoveDirectory & "\" & $GetBatchFiles[$I]) FileDelete($Directory & "\" & $GetBatchFiles[$I]) Next EndIf Msgbox(64, "Batch Mover", "Moved the first 1000 batch files to: " & @ScriptDir) Func _FileListToArray($Path, $Filter = "*") Local $Search, $File, $FileList[1] $Search = FileFindFirstFile($Path & "\" & $Filter) While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop ReDim $FileList[UBound($FileList) + 1] $FileList[0] += 1 $FileList[UBound($FileList) - 1] = $File WEnd FileClose($Search) Return $FileList EndFunc ;==>_FileListToArray Edited March 16, 2008 by JustinReno 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