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.

No comments: