TIEPortableDevices.CopyFileToDevice
Declaration
function CopyFileToDevice(const sDeviceID, sFolderID, sSourceFilename: WideString; MoveFile: Boolean = False): Boolean; overload;
function CopyFileToDevice(const sDeviceID, sFolderID: Widestring; SourceFilenames: TStrings; MoveFile: Boolean = False): Integer; overload;
Description
Copy local files to the specified
sFolderID on a device.
Parameter | Description |
sDeviceID | The ID of the device to copy to (e.g. ActiveDeviceID |
sFolderID | The ID of the folder to copy to (ID cannot point to a file) |
sSourceFilename | The local filename to copy to the device |
MoveFile | File is moved instead of copied |
Note: Only files can be copied, not folders.
// Prompt the user to specify a file to copy to the current folder
procedure TfrmMain.btnCopyToDeviceClick(Sender: TObject);
begin
// No active folder (or root)
if IEPortableDevices.ActiveFolderID = '' then
exit;
// Prompt for a file to copy
if OpenDialog1.Execute = False then
exit;
// Copy to folder on device
if IEPortableDevices.CopyFileToDevice( IEPortableDevices.ActiveDeviceID, IEPortableDevices.ActiveFolderID, OpenDialog1.FileName) then
ShowMessage( 'File successfully copied to device' )
else
ShowMessage( 'Failed to copy file to device!' );
end;