\S{psftp-cmd-chmod} The \c{chmod} command: change permissions on
remote files
-PSFTP allows you to modify the file permissions on files on the
-server. You do this using the \c{chmod} command, which works very
-much like the Unix \c{chmod} command.
+PSFTP allows you to modify the file permissions on files and
+directories on the server. You do this using the \c{chmod} command,
+which works very much like the Unix \c{chmod} command.
The basic syntax is \c{chmod modes file}, where \c{modes} represents
a modification to the file permissions, and \c{file} is the filename
-to modify. For example:
+to modify. You can specify multiple files or wildcards. For example:
\c chmod go-rwx,u+w privatefile
-\c chmod a+r publicfile
-\c chmod 640 groupfile
+\c chmod a+r public*
+\c chmod 640 groupfile1 groupfile2
The \c{modes} parameter can be a set of octal digits in the Unix
style. (If you don't know what this means, you probably don't want
the only permissions left are the ones for the file owner). \c{u+w}
adds write permission for the file owner.
-\b The second example: \c{a+r} adds read permission for everybody.
+\b The second example: \c{a+r} adds read permission for everybody to
+all files and directories starting with \q{public}.
In addition to all this, there are a few extra special cases for
Unix systems. On non-Unix systems these are unlikely to be useful:
\S{psftp-cmd-del} The \c{del} command: delete remote files
-To delete a file on the server, type \c{del} and then the filename:
+To delete a file on the server, type \c{del} and then the filename
+or filenames:
\c del oldfile.dat
+\c del file1.txt file2.txt
+\c del *.o
+
+Files will be deleted without further prompting, even if multiple files
+are specified.
+
+\c{del} will only delete files. You cannot use it to delete
+directories; use \c{rmdir} for that.
The \c{rm} command works exactly the same way as \c{del}.
\c mkdir newstuff
+You can specify multiple directories to create at once:
+
+\c mkdir dir1 dir2 dir3
+
\S{psftp-cmd-rmdir} The \c{rmdir} command: remove remote directories
To remove a directory on the server, type \c{rmdir} and then the
-directory name:
+directory name or names:
\c rmdir oldstuff
+\c rmdir *.old ancient
+
+Directories will be deleted without further prompting, even if
+multiple directories are specified.
Most SFTP servers will probably refuse to remove a directory if the
directory has anything in it, so you will need to delete the
contents first.
-\S{psftp-cmd-ren} The \c{ren} command: rename remote files
+\S{psftp-cmd-mv} The \c{mv} command: move and rename remote files
+
+To rename a single file on the server, type \c{mv}, then the current
+file name, and then the new file name:
+
+\c mv oldfile newname
+
+You can also move the file into a different directory and change the
+name:
+
+\c mv oldfile dir/newname
-To rename a file on the server, type \c{ren}, then the current file
-name, and then the new file name:
+To move one or more files into an existing subdirectory, specify the
+files (using wildcards if desired), and then the destination
+directory:
-\c ren oldfile newname
+\c mv file dir
+\c mv file1 dir1/file2 dir2
+\c mv *.c *.h ..
-The \c{rename} and \c{mv} commands work exactly the same way as
-\c{ren}.
+The \c{rename} and \c{ren} commands work exactly the same way as
+\c{mv}.
\S{psftp-cmd-pling} The \c{!} command: run a local Windows command
},
{
"cd", TRUE, "change your remote working directory",
- " [ <New working directory> ]\n"
+ " [ <new working directory> ]\n"
" Change the remote working directory for your SFTP session.\n"
" If a new working directory is not supplied, you will be\n"
" returned to your home directory.\n",
},
{
"chmod", TRUE, "change file permissions and modes",
- " ( <octal-digits> | <modifiers> ) <filename>\n"
- " Change the file permissions on a file or directory.\n"
- " <octal-digits> can be any octal Unix permission specifier.\n"
- " Alternatively, <modifiers> can include:\n"
+ " <modes> <filename-or-wildcard> [ <filename-or-wildcard>... ]\n"
+ " Change the file permissions on one or more remote files or\n"
+ " directories.\n"
+ " <modes> can be any octal Unix permission specifier.\n"
+ " Alternatively, <modes> can include the following modifiers:\n"
" u+r make file readable by owning user\n"
" u+w make file writable by owning user\n"
" u+x make file executable by owning user\n"
sftp_cmd_close
},
{
- "del", TRUE, "delete a file",
- " <filename>\n"
- " Delete a file.\n",
+ "del", TRUE, "delete files on the remote server",
+ " <filename-or-wildcard> [ <filename-or-wildcard>... ]\n"
+ " Delete a file or files from the server.\n",
sftp_cmd_rm
},
{
"delete", FALSE, "del", NULL, sftp_cmd_rm
},
{
- "dir", TRUE, "list contents of a remote directory",
+ "dir", TRUE, "list remote files",
" [ <directory-name> ]/[ <wildcard> ]\n"
" List the contents of a specified directory on the server.\n"
" If <directory-name> is not given, the current working directory\n"
sftp_cmd_mget
},
{
- "mkdir", TRUE, "create a directory on the remote server",
- " <directory-name>\n"
- " Creates a directory with the given name on the server.\n",
+ "mkdir", TRUE, "create directories on the remote server",
+ " <directory-name> [ <directory-name>... ]\n"
+ " Creates directories with the given names on the server.\n",
sftp_cmd_mkdir
},
{
sftp_cmd_mput
},
{
- "mv", TRUE, "move or rename a file on the remote server",
- " <source-filename> <destination-filename>\n"
- " Moves or renames the file <source-filename> on the server,\n"
- " so that it is accessible under the name <destination-filename>.\n",
+ "mv", TRUE, "move or rename file(s) on the remote server",
+ " <source> [ <source>... ] <destination>\n"
+ " Moves or renames <source>(s) on the server to <destination>,\n"
+ " also on the server.\n"
+ " If <destination> specifies an existing directory, then <source>\n"
+ " may be a wildcard, and multiple <source>s may be given; all\n"
+ " source files are moved into <destination>.\n"
+ " Otherwise, <source> must specify a single file, which is moved\n"
+ " or renamed so that it is accessible under the name <destination>.\n",
sftp_cmd_mv
},
{
"open", TRUE, "connect to a host",
" [<user>@]<hostname> [<port>]\n"
" Establishes an SFTP connection to a given host. Only usable\n"
- " when you did not already specify a host name on the command\n"
- " line.\n",
+ " when you are not already connected to a server.\n",
sftp_cmd_open
},
{
sftp_cmd_quit
},
{
- "reget", TRUE, "continue downloading a file",
+ "reget", TRUE, "continue downloading files",
" [ -r ] [ -- ] <filename> [ <local-filename> ]\n"
" Works exactly like the \"get\" command, but the local file\n"
" must already exist. The download will begin at the end of the\n"
sftp_cmd_mv
},
{
- "reput", TRUE, "continue uploading a file",
+ "reput", TRUE, "continue uploading files",
" [ -r ] [ -- ] <filename> [ <remote-filename> ]\n"
" Works exactly like the \"put\" command, but the remote file\n"
" must already exist. The upload will begin at the end of the\n"
sftp_cmd_rm
},
{
- "rmdir", TRUE, "remove a directory on the remote server",
- " <directory-name>\n"
+ "rmdir", TRUE, "remove directories on the remote server",
+ " <directory-name> [ <directory-name>... ]\n"
" Removes the directory with the given name on the server.\n"
- " The directory will not be removed unless it is empty.\n",
+ " The directory will not be removed unless it is empty.\n"
+ " Wildcards may be used to specify multiple directories.\n",
sftp_cmd_rmdir
}
};