Jump to content

Recommended Posts

Posted

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!

Posted

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()

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...