Braese Posted January 16, 2009 Posted January 16, 2009 Hi, in example i have 6000 files in one folder, i will every 50 files make a new folder called 1 or folder one or whatever and copy first 50 files in this new folder. Then make next folder called two and copy next 50 files in it. This is theory. Possible with AutoIt i think, im not sure how can i get all files and then cut every 50 or a X Number of it into a new folder, perhaps any help? Thank you!
FireFox Posted January 16, 2009 Posted January 16, 2009 $first = FileFindFirstFile("yourfolder\*.*") If @Error Then Exit Local $nb = 0, $fldrnb = 0, $fldr = "yourfolderoutput" While 1 $sd = FileFindNextFile($first) If @error then ExitLoop FileCopy($sd, $fldr & $fldrnb) $nb += 1 If $nb = 50 then $fldrnb += 1 DirCreate($fldr & $fldrnb) $nb = 0 EndIf WEnd Cheers, FireFox.
Andreik Posted January 16, 2009 Posted January 16, 2009 Hi, in example i have 6000 files in one folder, i will every 50 files make a new folder called 1 or folder one or whatever and copy first 50 files in this new folder. Then make next folder called two and copy next 50 files in it. This is theory. Possible with AutoIt i think, im not sure how can i get all files and then cut every 50 or a X Number of it into a new folder, perhaps any help? Thank you!#include <File.au3> $PATH = FileSelectFolder("SELECT","") $FILE = _FileListToArray($PATH,"*",1) $OUTPUT = "Output1" DirCreate($OUTPUT) Local $COUNT = 1, $FOLDER_INDEX = 1 ProgressOn("Copy",$PATH) For $INDEX = 1 To $FILE[0] ProgressSet(Int($INDEX*100/$FILE[0]),$PATH & "\" & $FILE[$INDEX]) FileCopy($PATH & "\" & $FILE[$INDEX],$OUTPUT) If $COUNT = 50 Then $COUNT = 0 $FOLDER_INDEX += 1 $OUTPUT = "Output" & $FOLDER_INDEX DirCreate($OUTPUT) EndIf $COUNT += 1 Next ProgressOff()
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