Jump to content

Recommended Posts

Posted

$FileList=_FileListToArray("M:\Backup")

_ArrayDisplay( $Filelist, "Class List of Active Window" )

$max = _ArrayMax ( $Filelist, 1)

MsgBox(0,'Max Index String value',$Filelist[$max])

FileCopy("M:\Backup\" & "$Filelist[$max]" , "C:\Test\" & "$Filelist[$max]")

1Make an array with filelist in it

2. Display array e.t.c

The file copy code doesn't work, can someone tell me whats wrong with it(i am trying to copy the last entry in the array)

  • Moderators
Posted (edited)

1. Name your thread titles descriptive of what it is you need or are talking about. That helps others when searching, and people that would have no clue on how to help, not to waste their time.

2. Use AutoIt code tags when posting code (forum ettiquette).

3. You need to check out what _ArrayMax() really does.

4. You can't surround a variable with quotes (SciTe should have thrown that error FileCopy("M:\Backup\" & "$Filelist[$max]"

5. To return the last element in the array ... try this:

#include <file.au3>
$FileList = _FileListToArray("M:\BackUp", "*.*", 1)
FileCopy("M:\Backup\" & $FileList[UBound($FileList) - 1], "C:\Test\" & $FileList[UBound($FileList) - 1], 9)
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
×
×
  • Create New...