PDA

View Full Version : Help badly needed with simple code!



4090987414711
08-11-2007, 01:17 PM
Hi and sorry for being so stuppid here, but why wont the following code work :

StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowCancelButton(true, "Cancel");
File.Copy(_SourceDrive.. "\\DCIM\\100CAMEA\\*.*", "D:\\Backup\\DigiCam\\", true, true, true, true, nil);
error = Application.GetLastError();
StatusDlg.Hide();
if error ~= 0 then
result = Dialog.Message("Error", "There was an error copying the files to your system. Please try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
else
--it was sucessful!!
end

I get the following error:

There was an error copying files to your system"

Sorry again & help greatfully recieved :)

reteset
08-11-2007, 02:22 PM
File.Copy(_SourceDrive.. "\\DCIM\\100CAMEA\\ *.*" , "D:\\Backup\\DigiCam\\", true, true, true, true, nil);

this must be real file path

for multiple file copy operations use following code


search = File.Find(_SourceDrive.. "\\DCIM\\100CAMEA\\" , "*.*", false, false, nil, nil);
if search ~= nil then
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.ShowCancelButton(true, "Cancel");
for i,file_path in search do
File.Copy(file_path, "D:\\Backup\\DigiCam\\", true, true, true, true, nil);
error = Application.GetLastError();
if error ~= 0 then
Dialog.Message("Error", "There was an error copying the:\n"..file_path, MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end
end
StatusDlg.Hide();
--it was sucessful!!
else
Dialog.Message("Error", "No Files Found In Destination Folder", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end

4090987414711
08-11-2007, 03:30 PM
Thanks for that, but I spotted my mistake...
I built it as a single, compressed file and of course, this runs from the hard drive, not the media I wanted it to run from (digital camera memory card)

it all works perfect now thanks dude :)