Get Files in Directory

Nov 21, 2012 at 7:53 PM

Good afternoon.

How can I return all file of a particular directory from a mobile device by means of OpenNETCF.Desktop.Communication

Thank you.

Nov 28, 2012 at 10:11 PM

Here is a quick example of how to copy files from a mobile device using OpenNETCF.Desktop.Communcation

string localDestinationFolder = @"c:\copied_files\";
string deviceSourceFolder = @"\MUSIC\AllGoodThings\";
string deviceFileSearchCriteria = "*.*";

if ( !Directory.Exists( localDestinationFolder ) )
{
    Directory.CreateDirectory( localDestinationFolder );
}

using ( RAPI device = new RAPI( ) )
{
    if ( device.DevicePresent )
    {
        device.Connect( );
        var fileNames = device.EnumerateFiles( Path.Combine( deviceSourceFolder , deviceFileSearchCriteria ) );
        foreach( var file in fileNames )
        {
            if ( file.FileAttributes == ( int )OpenNETCF.Desktop.Communication.RAPI.RAPIFileAttributes.Normal )
            {
                device.CopyFileFromDevice(
                    Path.Combine( localDestinationFolder , file.FileName ) , // desktop path
                    Path.Combine( deviceSourceFolder , file.FileName ) ,     // device path
                    true // overwrite existing file
                );
            }
        }
    }
}
Mar 12, 2014 at 9:48 PM
How can you this in VB 2010?