Sign in to follow this  
Followers 0
4Bravo

Using FileCopy in array?

2 posts in this topic

#1 ·  Posted (edited)

I've double checked the arrays, and used the function manually, with out the array. But I don't know where to plug this FileCopy in a For and Next. Every time I execute it I get an oddly named file in the directory the script was launched from.

Blah... I realised I forgot [$i] after the array

#include <Array.au3>
#include <RecFileListToArray.au3>
AutoItSetOption("TrayIconDebug",True)
$sPath = "D:Temp"
$movFILE = "D:mov.veg"
$flaDIR = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 2)
$justFILE = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 0)

For $i = 1 To $justFILE[0]
$justFILE[$i] = StringTrimRight($justFILE[$i], 4)
next
For $i = 1 To $flaDIR[0]
$flaDIR[$i] = StringReplace($flaDIR[$i], $justFILE[$i] & ".fla", "")

FileCopy($movFILE, $flaDIR[$i])
next
Edited by 4Bravo

Share this post


Link to post
Share on other sites



It appears as though you are searching for each directory that contains an "fla" file and copying "mov.reg" to that directory. You can try this as it is little less code:

#include <Array.au3>
#include <RecFileListToArray.au3>
AutoItSetOption("TrayIconDebug", True)
Local $sPath, $movFILE, $DestDir
$sPath = "D:Temp"
$movFILE = "D:mov.veg"
$flaDIR = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 2)

For $i = 1 To $flaDIR[0]
$DestDir = StringRegExpReplace($flaDIR[$i], '[^]+$', '')
FileCopy($movFILE, $DestDir)
Next

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0