Sunday, July 30, 2006

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.

No comments: