Inside and Out…

An attempt to understand technology better…

CERapi – Using CEFolder and CEFile

Posted by Gaurav Khanna on April 1, 2005

CERapi allows you to work with the file system of the Windows CE device and the snippet below shows how easy it is to do the same:

// Working with device folders

CEFolder rootFolder = newCEFolder(\\storage\\My Documents);
Console.WriteLine(“Path: {0}”,rootFolder.Path);
Console.WriteLine(“Total Files: {0}”,rootFolder.TotalFileCount);
Console.WriteLine(“Total SubFolders: {0}”,rootFolder.TotalSubFolderCount);

// Copy File from desktop
Console.WriteLine(“Move C:\\CASDEMO.TXT to device: {0}”,rootFolder.MoveFileFromDesktop(“c:\\CASDEMO.TXT”).ToString());
string
[] arrFolders = rootFolder.SubFolders;
foreach(stringstrFolder in
arrFolders)
Console.WriteLine(“SubFolder: {0} “,strFolder);

Console.WriteLine(“”);

string[] arrFiles = rootFolder.Files;
foreach(stringstrFile in
arrFiles)
Console.WriteLine(“File: {0} “,strFile);

Console.WriteLine(“”);

Console.WriteLine(“Parent Folder: {0}”, rootFolder.ParentFolder);
Console.WriteLine(“Archive: {0}”,rootFolder.IsArchive.ToString());
Console.WriteLine(“Created on: {0}”,rootFolder.CreationTime.ToString());
Console.WriteLine(“LastAccessed on: {0}”,rootFolder.LastAccessTime.ToString());
Console.WriteLine(“LastWritten on: {0}”,rootFolder.LastWriteTime.ToString());
Console.WriteLine(“Size: {0}”,rootFolder.Size.ToString());
Console.WriteLine(“OID on: {0}”,rootFolder.OID.ToString());
Console.WriteLine(“CreateFolder: {0}”,rootFolder.CreateFolder(“SubFolder”).ToString());
Console.WriteLine(“DeleteFolder: {0}”,rootFolder.DeleteFolder(“SubFolder”).ToString());

Download CERapi from http://www.wintoolzone.com/showpage.aspx?url=dotnet.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: