Sunday, July 30, 2006

The cePull Utility

The counterpart to the cePush utility (described in the last post) is cePull. The cePull utility performs the opposite task by copying files from a connected device to the desktop. A variety of options are supported.

cePull
The cePull utility is run on a desktop computer to copy files from the connected device to the desktop machine. The cePull utility is similar to the Command Prompt’s Copy command except the source files are always on the device and the destination is always on the desktop computer.

Usage:
cePull [device path] [destination path] [Options]
[device path] source path on device
[destination path] destination path
Options:
[/?] Display usage.
[/Y] Suppress overwrite confirmation.
[/S] Suppress hash mark status.
[/D] Copies only files whose source time is newer than the destination time.
[/R] Includes all Subdirectories.
[/O ] Omit path
[/OF ] Omit path file
[/X ] Exclude file
[/XF ] Exclude file file


If the source or destination paths contain spaces, make sure to enclose the paths in quotes. For example, if the source path is \My Documents on the device, it should be specified as "\My Documents" on the command line.

The source path can be a path and a specific filename or a path with a wildcarded filename (such as *.txt, *.*, etc.). If a wildcarded filename is specified in the source path, then the destination path must be an existing directory on the desktop (and not a filename). If the source path is a specific file (with no wildcards), the destination can be a directory, in which case the file will be copied with the same name to the desktop in the destination directory on the desktop. If the source path is a specific file and the destination path specifiies a file of a different name, the copied file will be renamed to the destination filename when copied to the desktop.
A hash mark (#) is displayed for every 10K bytes transferred by the cePull utility. Use the /S flag to suppress the hash mark display.

By default, the cePull utility will confirm that a file is to be overwritten if it already exists on the desktop. The overwrite confirmation will ask for a Yes, No, or All. Enter the first letter of the answer and press Enter. If Yes is selected, the file will be overwritten; if No is selected, the file will not be overwritten; and if All is selected, the file is overwritten and Yes will be answered for subsequent confirmations. If the /Y flag is specified on the command line, the confirmation will not be presented and any existing files will be overwritten.

The /D flag can be specified to perform a date compare when a file being copied from the device already exists on the desktop. If the date on the desktop file is newer than the device file, it will be skipped. A message is displayed saying that the file was skipped (the /S flag will suppress the display of the skip message).

The /R flag can be specified to recursively include all subdirectories found in the device source path. When using the /R flag, the destination path must be an existing directory (and not a file). If any files matching the search criteria are found in the device path, the files will be copied in the same directory structure on the desktop under the destination path. If the subdirectories do not exist on the desktop, they will be created.

The /O flag can be used to specify paths not to be included in the copy. The /O flag can be used as many times as necessary to specify multiple paths; however, the /OF flag can be used to specify a file on the desktop that contains a list of paths to omit. Paths can be specified as relative paths. The current directory on device will be used if the paths are relative. The omit path file should contain one path per line. If a line begins with a pound sign (#), the line will be ignored. The /O and /OF flags are generally useful only if the /R flag has also been specified.

/O
/O "\my documents\test1"
/OF
/OF c:\temp\omitPath.txt

The /X flag can be used to specify a specific file to be excluded from the copy. The /X flag can be used as many times as needed to specify multiple files to exclude. A file name can be a relative path and can contain wildcards. If a relative path is used, the current directory on the device will be used. If a wildcarded filename is specified, all files matching the specified criteria will be excluded from the copy. If many files need to be excluded, the /XF flag can be used to specify a file on the desktop that includes a list of files to exclude. The exclude file should contain one file per line. If a line begins with a pound sign (#), the line will be ignored.

/X
/X *.txt
/X "\my documents\file.txt"
/XF
/XF c:\temp\exclude.txt


With version 2.0.0.2+ of the cePull utility, relative paths can be used for both the device source path and the desktop destination path. For the device source path, relative paths are relative to the current directory on the device (which is set with the ceCD utility). For desktop paths, relative paths are relative to the path you are currently in when you run the cePull utility. The destination path can also be omitted completely and the current directory will be used.

See Also:
cePush, ceCopy, ceMove, ceCD

Examples:

C:\>cePull \temp\file*.* c:\temp

Copies all files in the \temp directory on the device beginning with “file” to the C:\temp directory on the desktop.

C:\temp>cePull *.txt

Assuming the current directory on the device is “\My Documents” (which is set with the ceCD utility), all files with the .txt extension will be copied from the device’s \My Documents directory to the C:\temp directory (since no destination path is specified, the destination will be the current directory on the desktop).

C:\temp>cePull "\My Documents\*.txt" c:\temp\data /R

All files in the \My Documents directory with the .txt extension will be copied to the C:\temp\data directory. Also, all subdirectories in the \My Documents directory on the device will also be searched for *.txt files, and any subdirectories in the subdirectories, and so forth. The source path contains a space, so it must be enclosed in quotes ("…").

C:\temp\cePull "\My Documents\device.txt" c:\temp\test\desktop.txt

The device.txt file in the \My Documents directory on the device will be copied and renamed to desktop.txt in the c:\temp\test directory on the desktop. The source path contains a space, so it must be enclosed in quotes ("…").

C:\temp\cePull "\My Documents\*.*" c:\temp /R /O "\My documents\test"

All files in the \My Documents directory will be copied from the device to the c:\temp directory on the desktop including all subdirectories with the exception of the \my documents\test directory.

C:\temp\cePull "\My Documents\*.*" c:\temp /X *.txt /X "\my documents\test.ini"

All files in the \My Documents directory will be copied from the device to the c:\temp directory on the desktop except files that end in .txt and a file called test.ini.

C:\temp>cePull *.txt

cePull - version 02.00.00.02
(c) Srego, Inc - 2004
Current Device Directory : \My Documents
Current Desktop Directory: L:\dog\cePull1\Debug
Source Path : \My Documents \*.txt
Destination Path: C:\temp
Copying: test1.txt (15,120 bytes)
Destination: C:\temp\test1.txt
#####
15,120 bytes copied.
Copying: test2.txt (292 bytes)
Destination: C:\temp\test2.txt
292 bytes copied.
2 files copied.

The cePush Utility

The Srego CE ToolPack is comprised of utilities to make development or any interaction with a connected device more efficient. Most of these tools were spawned from the development needs of the time and then rolled into generic tools and then packaged together. Since the beginning there have been several requests for new utilities and new functionality in the existing ones, but the tools that started it all were cePush and its counterpart cePull. This entry will provide some of the documentation for cePush and gives some examples of how it is used.

cePush

The cePush utility is run on a desktop computer to copy files from the desktop computer to the connected Windows CE or Windows Mobile device. The cePush utility is similar to the Command Prompt’s Copy command except the source files are always on the desktop computer and the destination is always on the Windows CE device.

Usage:
cePush - version 02.00.00.02
(c) Srego, Inc - 2004
Usage: cePush [source path] [device path] [options]
[source path] source path on the desktop
[device path] destination path on device
Options:
[/?] Display usage.
[/Y] Suppress overwrite confirmation.
[/S] Suppress hash mark status.
[/D] Copies only files whose source time is newer than the destination time.
[/R] Includes all Subdirectories.
[/O ] Omit path
[/OF ] Omit path file
[/X ] Exclude file
[/XF ] Exclude file file


If the source or destination paths contain spaces, make sure to enclose the paths in quotes. For example, if the source path is \My Documents on the device, it should be specified as "\My Documents" on the command line.

The source path can be a path and a specific filename or a path with a wildcarded filename (such as *.txt, *.*, etc.). If a wildcarded filename is specified in the source path, then the destination path must be an existing directory on the device (and not a filename). If the source path is a specific file (with no wildcards), the destination can be a directory, in which case the file will be copied with the same name to the device in the destination directory on the device. If the source path is a specific file and the destination path specifics a file of a different name, the copied file will be renamed to the destination filename when copied to the device.
A hash mark (#) is displayed for every 10K bytes transferred by the cePush utility. Use the /S flag to suppress the hash mark display.

By default, the cePush utility will confirm that a file is to be overwritten if it already exists on the desktop. The overwrite confirmation will ask for a Yes, No, or All. Enter the first letter of the answer and press Enter. If Yes is selected, the file will be overwritten; if No is selected, the file will not be overwritten; and if All is selected, the file is overwritten and Yes will be answered for subsequent confirmations. If the /Y flag is specified on the command line, the confirmation will not be presented and any existing files will be overwritten.

The /D flag can be specified to perform a date compare when a file being copied from the desktop already exists on the device. If the date on the device file is newer than the desktop file, it will be skipped. A message is displayed saying that the file was skipped (the /S flag will suppress the display of the skip message).

The /R flag can be specified to recursively include all subdirectories found in the desktop source path. When using the /R flag, the destination path must be an existing directory (and not a file). If any files matching the search criteria are found in the desktop path, the files will be copied in the same directory structure on the device under the destination path. If the subdirectories do not exist on the device, they will be created.

The /O flag can be used to specify paths not to be included in the copy. The /O flag can be used as many times as necessary to specify multiple paths; however, the /OF flag can be used to specify a file on the desktop that contains a list of paths to omit. Paths can be specified as relative paths. The current directory on desktop will be used if the paths are relative. The omit path file should contain one path per line. If a line begins with a pound sign (#), the line will be ignored. The /O and /OF flags are generally useful only if the /R flag has also been specified.

/O
/O "c:\data\test1"
/OF
/OF c:\temp\omitPath.txt


The /X flag can be used to specify a specific file to be excluded from the copy. The /X flag can be used as many times as needed to specify multiple files to exclude. A file name can be a relative path and can contain wildcards. If a relative path is used, the current directory on the desktop will be used. If a wildcarded filename is specified, all files matching the specified criteria will be excluded from the copy. If many files need to be excluded, the /XF flag can be used to specify a file on the desktop that includes a list of files to exclude. The exclude file should contain one file per line. If a line begins with a pound sign (#), the line will be ignored.

/X
/X *.txt
/X "\my documents\file.txt"
/XF
/XF c:\temp\exclude.txt


With version 2.0.0.2+ of the cePush utility, relative paths can be used for both the desktop source path and the destination device path. For desktop source path, relative paths are relative to the path you are currently in when you run the cePush utility. For the device path, relative paths are relative to the current directory on the device (which is set with the ceCD utility). The destination path can also be omitted completely and the current directory will be used.

Examples:

C:\>cePush c:\temp\file*.* \temp

Copies all files in the c:\temp directory on the desktop beginning with “file” to the \temp directory on the device.

C:\temp>cePush *.txt

Assuming the current directory on the device is “\My Documents” (which is set with the ceCD utility), all files with the .txt extension in the c:\temp directory (the current directory on the desktop) will be copied to the \My Documents directory on the device (since no destination path is specified, the destination will be the current directory on the device).

C:\temp>cePush c:\temp\data\*.txt "\My Documents" /R

All files in the c:\temp\data directory with the .txt extension will be copied to the \My Documents directory on the device.. Also, all subdirectories in the c:\temp\data directory on the desktop will also be searched for *.txt files, and any subdirectories in the subdirectories, and so forth. The device path contains a space, so it must be enclosed in quotes ("…").

C:\temp\cePush c:\temp\*.* "\My Documents" /R /O "\My documents\test"

All files in the c:\temp\*.* directory will be copied from the desktop to the \My Documents directory on the device including all subdirectories with the exception of the c:\temp\test directory.

C:\Temp>cePush file*.* "\My Documents"

cePush - version 02.00.00.02
(c) Srego, Inc - 2004
Current Desktop Directory: C:\TEMP
Current Device Directory : \my documents
Source Path : C:\TEMP\file*.*
Destination Path: \My Documents
Copying: file.txt (85 bytes) (1 of 5)
Destination: \My Documents\file.txt
85 bytes copied.
Copying: file1.txt (66,821 bytes) (2 of 5)
Destination: \My Documents\file1.txt
#######
66,821 bytes copied.
Copying: file2.txt (12,384 bytes) (3 of 5)
Destination: \My Documents\file2.txt
##
12,384 bytes copied.
Copying: file3.txt (539,908 bytes) (4 of 5)
Destination: \My Documents\file3.txt
#####################################################
539,908 bytes copied.
Copying: filelist.txt (99 bytes) (5 of 5)
Destination: \My Documents\filelist.txt
99 bytes copied. 5 files copied.

Similar CE Tools and Utilities

I am sure there are several utilities on the internet similar to the Srego products. I want to go through as many as I can find and I will update this list as I find more.

For the Srego CE ToolPack command-line utilties, a set of tools from General Paranoyaxc Software as been pointed out to me. There are a lot of good utilities and tools here worth looking at, and they are all free. I point this site out because I read a posting about the Srego CE ToolPack once that sounded like the utilities I provide are freely available elsewhere. The answer is yes and no. Yes, there are similar tools available else where, but there is a significant amount of functionality added to the Srego tools not found in the free ones.

There are also developer tools similar to the Srego CE ToolPack ActiveX control. One example is from VBCE.com: CeConnect, CeConnectFile, CEConnectSystem, CeConnectEvents. These are all good tools with evaluation versions to try. There are other controls from VBCE.com available for the CE platform: vbceDateTimePicker, vbceProgressBar, etc. Check these out too. Another good resource for developers wanting to use the Microsoft .NET Compact Framework is www.OpenNETCF.org

Srego CE ToolPack ActiveX Control

The Srego CE ToolPack ActiveX Control is a development tool that encapsulates many of the features found in the Srego CE ToolPack command-line utilities. From the desktop, the ActiveX control can detect device connection and disconnection, manipulate files on the device, read and modify the device's registry, and interact with databases on the device. The ActiveX control communicates with the connected device via RAPI (Remote Application Programming Interface) and requires no software to be loaded on the device.

The Srego CE ToolPack ActiveX Control is a development tool that will work with Visual Basic or Visual C++ or any other development tools that support ActiveX controls.
Royalty-Free Distribution of the runtime is permitted as long as each developer using the control purchases a license.

The Srego CE ToolPack ActiveX Control provides methods to accomplish the following tasks:

Determining Device Connection Status

  • Events for device connection and disconnection
  • IP address Assignment

File Manipulation

  • Copy, Move, Push, Pull, Compare Directories
  • MakeDir, RemoveDir, FileList, Touch

Registry Manipulation

  • Read, Write, Delete, List

Database Manipulation

  • Create/Delete/List Databases, Add/Delete/Search Records

Device Information

  • Battery
  • Info, Processor Type, Memory Info, Screen Size

Srego CE ToolPack Command-Line Utilities

The Srego CE ToolPack Command-Line tools provides a set of utilities for the Windows desktop to manipulate a connected Windows CE or Windows Mobile device. The utilities in the ToolPack utilize RAPI and ActiveSync to communicate with the device so virtually all Window CE and Windows Mobile platforms are supported: Window CE 2.11, Handheld PC, Handheld PC Pro, Pocket PC, Pocket PC 2002, Handheld PC 2000, Window Mobile 2003, Windows Mobile 2003 SE, Window CE.NET, and Windows Mobile 5.0.

All of the utilities are command-line tools that are run on the desktop (not the device). Most of the utilities are similar in functionality to an existing Command Prompt utility (such as Copy, Del, Move, Dir, MkDir, RmDir, and Start) only the task is performed on the device, not the desktop. For example, the ceDir utility provided in the Srego CE ToolPack is similar to the Command Prompt Dir command, only the directory information it displays on the desktop will come from the Windows CE device. Additionally, cePush and cePull can be used to move files back and forth between the desktop and the device and to synchronize files between the device and the desktop.

Most of the utilities in the Srego CE ToolPack are not new and there are a variety of freeware/shareware utilities available that can perform some of the tasks the ToolPack utilities can accomplish. However, the utilities in the ToolPack are well equipped to handle a variety of task and support features like wildcard in filenames, synchronization, auto retry, and also support a current directory concept on the device to mimic the current directory concept on the desktop.

The Srego CE ToolPack utilities can be used to increase productivity when dealing with Windows CE devices. These utility can be used directly from a Command-Prompt window or in script files.

The Srego CE ToolPack utilities use RAPI (Remote Application Programming Interface) to communicate with the Windows CE device and no software needs to be loaded on the device.
The Srego CE ToolPack utilities run on a Windows Desktop platform: 95/98/ME/NT/2000/XP. The utilities will works with the following Windows CE platforms: Windows CE 2.11, Windows CE 3.0, Pocket PC, Pocket PC 2002, Handheld PC 2000, Window Mobile 2003, Window Mobile 2003 SE, Window CE.NET, Windows Mobile 5.0.

Utilities included in the Srego CE ToolPack:

ceCD – Sets the current directory on the device for the use with the other utilities.
ceCopy - Copy files from one location to another on a device.
ceDel - Delete files on a device.
ceDir - List files on a device.
ceMkdir - Create a directory on a device.
ceMove - Move files from one directory to another on a device.
cePull - Copy a file from a device to a desktop computer.
cePush - Copy a file from desktop computer to device.
ceRmdir - Remove a directory on a device.
ceStart - Start an application on a device.
ceDbCopy - Moves a .mdb file from the desktop to a cdb on device and vice versa.
ceTouch - Updates a file's last write time on a device from the desktop.
ceJump - Copies ASCII file to desktop, launches editor, pushes file back to device.
ceReg – Read and Write Registry values on the device.

Introduction

Srego is dedicated to the development of mobile application on a variety of platforms. As a result of 12 plus years of mobile app development, a variety of tools and utilities have arisen to improve the usability and ease of mobile app development. The current focus has been Window CE platforms (Pocket PC, Windows Mobile, CE.NET, and SmartPhone) and the utilities are centered around these platforms. This Blog will be used as a depository for information on these utility and possibly generate some discussion on how to improve these tools and make them more useful for developers. Srego now provides 3 different software packages: Srego CE ToolPack, Srego CE ToolPack ActiveX Control. All of these utilities will work in an evaluation mode (free of charge) and commercial versions provide more functionality for a small fee. There are also some free utilities that have no other home and will be shared on this blog.