(emacs)Misc File Ops

Prev: Comparing Files Up: Files

Miscellaneous File Operations

   Emacs has commands for performing many other operations on files.
All operate on one file; they do not accept wild card file names.

   `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, `view-file' displays the
beginning.  You can then type SPC to scroll forward one windowful, or
DEL to scroll backward.  Various other commands are provided for moving
around in the file, but none for changing it; type `C-h' while viewing
for a list of them.  They are mostly the same as normal Emacs cursor
motion commands.  To exit from viewing, type `C-c'.  The commands for
viewing are defined by a special major mode called View mode.

   A related command, `M-x view-buffer', views a buffer already present
in Emacs.  Note: Misc Buffer.

   `M-x insert-file' inserts a copy of the contents of the specified
file into the current buffer at point, leaving point unchanged before
the contents and the mark after them.

   `M-x write-region' is the inverse of `M-x insert-file'; it copies
the contents of the region into the specified file.  `M-x
append-to-file' adds the text of the region to the end of the specified
file.  Note: Accumulating Text.

   `M-x delete-file' deletes the specified file, like the `rm' command
in the shell.  If you are deleting many files in one directory, it may
be more convenient to use Dired (Note: Dired.).

   `M-x rename-file' reads two file names OLD and NEW using the
minibuffer, then renames file OLD as NEW.  If a file named NEW already
exists, you must confirm with `yes' or renaming is not done; this is
because renaming causes the old meaning of the name NEW to be lost.  If
OLD and NEW are on different file systems, the file OLD is copied and

   The similar command `M-x add-name-to-file' is used to add an

   `M-x copy-file' reads the file OLD and writes a new file named NEW
with the same contents.  Confirmation is required if a file named NEW
already exists, because copying has the consequence of overwriting the
old contents of the file NEW.

   `M-x make-symbolic-link' reads two file names OLD and LINKNAME, then
creates a symbolic link named LINKNAME and pointing at OLD.  The effect
is that future attempts to open file LINKNAME will refer to whatever
file is named OLD at the time the opening is done, or will get an error
if the name OLD is not in use at that time.  This command does not
expand the argument FILENAME, so that it allows you to specify a
relative name as the target of the link.

   Confirmation is required when creating the link if LINKNAME is in
use.  Note that not all systems support symbolic links.

automatically generated by info2www