Emacs has commands for performing many other operations on files.
All operate on one file; they do not accept wildcard file names.
-@findex view-file
-@cindex viewing
-@cindex View mode
-@cindex mode, View
- @kbd{M-x view-file} allows you to scan or read a file by sequential
-screenfuls. It reads a file name argument using the minibuffer. After
-reading the file into an Emacs buffer, @code{view-file} displays the
-beginning. You can then type @key{SPC} to scroll forward one windowful,
-or @key{DEL} to scroll backward. Various other commands are provided
-for moving around in the file, but none for changing it; type @kbd{?}
-while viewing for a list of them. They are mostly the same as normal
-Emacs cursor motion commands. To exit from viewing, type @kbd{q}.
-The commands for viewing are defined by a special minor mode called View
-mode.
-
- A related command, @kbd{M-x view-buffer}, views a buffer already present
-in Emacs. @xref{Misc Buffer}.
-
-@kindex C-x i
-@findex insert-file
- @kbd{M-x insert-file} (also @kbd{C-x i}) inserts a copy of the
-contents of the specified file into the current buffer at point,
-leaving point unchanged before the contents. The position after the
-inserted contents is added to the mark ring, without activating the
-mark (@pxref{Mark Ring}).
-
-@findex insert-file-literally
- @kbd{M-x insert-file-literally} is like @kbd{M-x insert-file},
-except the file is inserted ``literally'': it is treated as a sequence
-of @acronym{ASCII} characters with no special encoding or conversion,
-similar to the @kbd{M-x find-file-literally} command
-(@pxref{Visiting}).
-
-@findex write-region
- @kbd{M-x write-region} is the inverse of @kbd{M-x insert-file}; it
-copies the contents of the region into the specified file. @kbd{M-x
-append-to-file} adds the text of the region to the end of the
-specified file. @xref{Accumulating Text}. The variable
-@code{write-region-inhibit-fsync} applies to these commands, as well
-as saving files; see @ref{Customize Save}.
-
@findex delete-file
@cindex deletion (of files)
@kbd{M-x delete-file} prompts for a file and deletes it. If you are
deleting many files in one directory, it may be more convenient to use
-Dired rather than @code{delete-file}. @xref{Dired}.
+Dired rather than @code{delete-file}. @xref{Dired Deletion}.
@cindex trash
@cindex recycle bin
- @kbd{M-x move-file-to-trash} moves a file into the operating
-system's @dfn{Trash} (or @dfn{Recycle Bin}). This is a facility
-available on most operating systems; files that are moved into the
-Trash can be brought back later if you change your mind.
+ @kbd{M-x move-file-to-trash} moves a file into the system
+@dfn{Trash} (or @dfn{Recycle Bin}). This is a facility available on
+most operating systems; files that are moved into the Trash can be
+brought back later if you change your mind.
@vindex delete-by-moving-to-trash
By default, Emacs deletion commands do @emph{not} use the Trash. To
commands in Dired (@pxref{Dired Deletion}). Supplying a prefix
argument to @kbd{M-x delete-file} or @kbd{M-x delete-directory} makes
them delete outright, instead of using the Trash, regardless of
-@code{delete-by-moving-to-trash}. The variable
-@code{delete-by-moving-to-trash} does not affect file deletions that
-happen as a side-effect of other Emacs commands (e.g. deletions of
-temporary files); those are always true deletions.
+@code{delete-by-moving-to-trash}.
+
+@findex copy-file
+@cindex copying files
+ @kbd{M-x copy-file} reads the file @var{old} and writes a new file
+named @var{new} with the same contents.
+
+@findex copy-directory
+ @kbd{M-x copy-directory} copies directories, similar to the
+@command{cp -r} shell command. It prompts for a directory @var{old}
+and a destination @var{new}. If @var{new} is an existing directory,
+it creates a copy of the @var{old} directory and puts it in @var{new}.
+If @var{new} is not an existing directory, it copies all the contents
+of @var{old} into a new directory named @var{new}.
@findex rename-file
- @kbd{M-x rename-file} reads two file names @var{old} and @var{new} using
-the minibuffer, then renames file @var{old} as @var{new}. If the file name
-@var{new} already exists, you must confirm with @kbd{yes} or renaming is not
-done; this is because renaming causes the old meaning of the name @var{new}
-to be lost. If @var{old} and @var{new} are on different file systems, the
-file @var{old} is copied and deleted.
-
- If the argument @var{new} is just a directory name, the real new
-name is in that directory, with the same non-directory component as
-@var{old}. For example, @kbd{M-x rename-file RET ~/foo RET /tmp RET}
-renames @file{~/foo} to @file{/tmp/foo}. The same rule applies to all
-the remaining commands in this section. All of them ask for
-confirmation when the new file name already exists, too.
+ @kbd{M-x rename-file} reads two file names @var{old} and @var{new}
+using the minibuffer, then renames file @var{old} as @var{new}. If
+the file name @var{new} already exists, you must confirm with
+@kbd{yes} or renaming is not done; this is because renaming causes the
+old meaning of the name @var{new} to be lost. If @var{old} and
+@var{new} are on different file systems, the file @var{old} is copied
+and deleted. If the argument @var{new} is just a directory name, the
+real new name is in that directory, with the same non-directory
+component as @var{old}. For example, @kbd{M-x rename-file RET ~/foo
+RET /tmp RET} renames @file{~/foo} to @file{/tmp/foo}. The same rule
+applies to all the remaining commands in this section. All of them
+ask for confirmation when the new file name already exists, too.
@findex add-name-to-file
@cindex hard links (creation)
- The similar command @kbd{M-x add-name-to-file} is used to add an
-additional name to an existing file without removing its old name.
-The new name is created as a ``hard link'' to the existing file.
-The new name must belong on the same file system that the file is on.
-On MS-Windows, this command works only if the file resides in an NTFS
-file system. On MS-DOS, it works by copying the file.
-
-@findex copy-file
-@findex copy-directory
-@cindex copying files
- @kbd{M-x copy-file} reads the file @var{old} and writes a new file
-named @var{new} with the same contents. @kbd{M-x copy-directory} does
-the same for directories, by recursive copying all files and
-subdirectories.
+ @kbd{M-x add-name-to-file} adds an additional name to an existing
+file without removing its old name. The new name is created as a
+``hard link'' to the existing file. The new name must belong on the
+same file system that the file is on. On MS-Windows, this command
+works only if the file resides in an NTFS file system. On MS-DOS, it
+works by copying the file.
@findex make-symbolic-link
@cindex symbolic links (creation)
@var{target} at the time the opening is done, or will get an error if
the name @var{target} is nonexistent at that time. This command does
not expand the argument @var{target}, so that it allows you to specify
-a relative name as the target of the link.
+a relative name as the target of the link. Not all systems support
+symbolic links; on systems that don't support them, this command is
+not defined.
+
+@kindex C-x i
+@findex insert-file
+ @kbd{M-x insert-file} (also @kbd{C-x i}) inserts a copy of the
+contents of the specified file into the current buffer at point,
+leaving point unchanged before the contents. The position after the
+inserted contents is added to the mark ring, without activating the
+mark (@pxref{Mark Ring}).
- Not all systems support symbolic links; on systems that don't
-support them, this command is not defined.
+@findex insert-file-literally
+ @kbd{M-x insert-file-literally} is like @kbd{M-x insert-file},
+except the file is inserted ``literally'': it is treated as a sequence
+of @acronym{ASCII} characters with no special encoding or conversion,
+similar to the @kbd{M-x find-file-literally} command
+(@pxref{Visiting}).
+
+@findex write-region
+ @kbd{M-x write-region} is the inverse of @kbd{M-x insert-file}; it
+copies the contents of the region into the specified file. @kbd{M-x
+append-to-file} adds the text of the region to the end of the
+specified file. @xref{Accumulating Text}. The variable
+@code{write-region-inhibit-fsync} applies to these commands, as well
+as saving files; see @ref{Customize Save}.
@findex set-file-modes
@cindex file modes