Command Line Interface (CLI)

BitPim now provides a stand-alone, Command Line Interface (CLI) feature that allows users to access and manipulate the phone file system without using the full BitPim GUI.

Syntax

The general BitPim CLI syntax is:

bitpim [CLI Command & Arguments] [-p comm port] [-f phone model]

or if you're running from source:

python bp.py [CLI Command & Arguments] [-p comm port] [-f phone model]

where:

CLI Command & Arguments: a space-separated string specifying the command and its arguments.
-p comm port (optional): specify the interface comm port through which BitPim communicates with the phone.
-f phone model (optional): specify the phone model of the current phone.

If either the comm port or the phone model is not specified, BitPim will use the current settings in the config file. If neither the comm port nor the phone model is available, BitPim will exit with an error.

File and Dir Name Syntax

Depending on the commands, the arguments can include one or more file or directory names. These files or directories can either reside locally on the PC or on the phone file system (FS), each of which has different syntax.

The syntax for specifying local file and directory names is defined by the OS.

The syntax for specifying phone FS is as follows:

phone:/[dir]/[dir]/.../[dir|file]

The directory name "." can be used to specify the current directory.
Currently, this syntax does not support wildcard characters.

Available Commands

ls [dir name] ...

List the names of the files and directories of the specified dir name on the phone file system. The arguments specify one or more phone FS dir names. The prefix phone: may be omitted from the directory names. The file/directory names are listed one per line.

Examples:

bitpim "ls phone:/nvm /pim"
lists the files and directories in phone FS dir "/nvm" and "/pim".

bitpim "ls phone:/" -p com5 -f LG-VX8500
lists the files and directories in the root directories of the phone FS using port com5 and phone model LG VX-8500.

bitpim "ls /" -c configfile
lists the files and directories in the root directory of the phone FS using the settings in the config file named configfile.

ll [dir name] ...

This command is similar to the ls command, with the following additions:
  1. Each directory entry displays a "d" in the first column (file entries display blanks).
  2. Each file entry dislays the file size and last-modified date/time if available.

cp [source dir/file name] [source dir/file name] ... [target dir name]

This command transfers file(s) from/to the phone FS. The syntax of the of [target dir name] dictates the direction of the transfer. If [target dir name] specifies a phone FS directory, this command copies files from either your PC or the phone FS to the target directory on the phone FS. If [target dir name] specifies a local directory, this command copies files from the phones FS to your local PC. In this case, all the source files/directories are assumed to be from the phone FS (ie. this command does not do local-to-local files copy).

Examples:

bitpim "cp nvm ."
bitpim "cp phone:/nvm ."
copies all files from the phone FS directory nvm to the local current directory.

bitpim "cp nvm phone:/nvm/nvm tmp"
copies all files from the phone directory nvm and nvm/nvm to local directory tmp.

bitpim "cp tune.mp3 phone:/nvm/nvm01.dat phone:/test"
copies local file tune.mp3 and phone FS file nvm/nvm01.dat to the phone FS directory test.

mkdir [dir name] ...

This command creates one or more directories on the phone FS. The [dir name] arguments are assumed to be on the phone FS, and the prefix phone: may be omitted.

Example:

bitpim "mkdir tmp phone:/tmp/tmp1"
creates 2 directories on the phone FS: tmp and tmp/tmp1.

rm [file name] ...

This command deletes one or more files on the phone FS. The arguments specify one or more phone FS file names. All file are assumed to reside on the phone FS and the prefix phone: may be omitted from the file names.

Examples:

bitpim "rm file1.txt phone:file2.txt tmp/file3.txt"
delete file file1.txt, file2.txt, tmp/file3.txt from the phone FS.

rmdir [dir name] ...

This command deletes one or more directories on the phone FS. The arguments specify one or more phone FS directory names. All directories are assumed to reside on the phone FS, and the prefix phone: may be omitted. The directories being deleted must be empty.

Examples:

bitpim "rmdir tmp phone:tmp1"
deletes directory tmp and tmp1 from the phone FS.

cli

This command provides a primitive interactive BitPim shell that allows users to enter BitPim CLI commands and view the results. There are several subcommands available only within the shell. These subcommands are:

cd [dir name]

This command sets the current phone FS working directory to the specified one. Non-full-path phone FS file names and directory names (name that do not start with "/") specified in subsequent commands will be relative to the current working directory. The prefix phone: may be omitted from the argument.

cdu

This command sets the current working directory to the parent directory.

pwd
cwd

This command prints the name of the current workding directory.

exit

This command exits the shell and terminates the program.

BitPim Online Help built 17 January 2010