6.2.1 General quoting rules for PSFTP commands
Most PSFTP commands are considered by the PSFTP command interpreter as a sequence of words, separated by spaces. For example, the command ren oldfilename newfilename splits up into three words: ren (the command name), oldfilename (the name of the file to be renamed), and newfilename (the new name to give the file).
Sometimes you will need to specify file names that contain spaces. In order to do this, you can surround the file name with double quotes. This works equally well for local file names and remote file names:
psftp> get "spacey file name.txt" "save it under this name.txt"
The double quotes themselves will not appear as part of the file names; they are removed by PSFTP and their only effect is to stop the spaces inside them from acting as word separators.
If you need to use a double quote (on some types of remote system, such as Unix, you are allowed to use double quotes in file names), you can do this by doubling it. This works both inside and outside double quotes. For example, this command
psftp> ren ""this"" "a file with ""quotes"" in it"
will take a file whose current name is "this" (with a double quote character at the beginning and the end) and rename it to a file whose name is a file with "quotes" in it.
(The one exception to the PSFTP quoting rules is the ! command, which passes its command line straight to Windows without splitting it up into words at all. See
section 6.2.19
.)
6.2.2 Wildcards in PSFTP
Several commands in PSFTP support ‘wildcards’ to select multiple files.
For local file specifications (such as the first argument to put), wildcard rules for the local operating system are used. For instance, PSFTP running on Windows might require the use of *.* where PSFTP on Unix would need *.
For remote file specifications (such as the first argument to get), PSFTP uses a standard wildcard syntax (similar to POSIX wildcards):
* matches any sequence of characters (including a zero-length sequence).
? matches exactly one character.
[abc] matches exactly one character which can be a, b, or c.
[a-z] matches any character in the range a to z.
[^abc] matches a single character that is not a, b, or c.
Special cases: [-a] matches a literal hyphen (-) or a; [^-a] matches all other characters. [a^] matches a literal caret (^) or a.
\ (backslash) before any of the above characters (or itself) removes that character's special meaning.
A leading period (.) on a filename is not treated specially, unlike in some Unix contexts; get * will fetch all files, whether or not they start with a leading period.
6.2.3 The open command: start a session