FolderItem.CopyTo Issue

I am trying to get away from using Shell scripts to copy data from one location on a Mac to an external drive. I am playing around with the example provided in the LR, but I keep getting the following message: “You must use the value returned by this function”. I am sure it is an easy fix and below is my code snippet:

[code]for i as Integer = 0 to List.ListCount-1

Dim source As FolderItem
source = GetFolderItem (List.Cell(i,0).ToText, FolderItem.PathTypeNative)
Dim destination As FolderItem
destination = New FolderItem ("/Volumes/Test/Collection/", FolderItem.PathTypeNative)

CopyFileOrFolder(source, destination)

next[/code]

Any help would be greatly appreciated.

That sample function returns a boolean.

[quote]
It returns True if all files in the folder were successfully copied and returns False otherwise.[/quote]

You can either declare a boolean and use it to check for errors:

dim b as boolean = CopyFileOrFolder(source, destination)

or ignore the error checking

call CopyFileOrFolder(source, destination)

Thanks Scott. If I declare the boolean to allow checking, how do I get the results returned. It doesn’t seem to be working for me.

If you do this:

dim b as boolean = CopyFileOrFolder(source, destination)

Per the LR, if b is true then all files were successfully copied. If b is false, not all were copied successfully.

if b then msgbox("all copied successfully") else msgbox("not all copied successfully") end if