(lemacs.info)Misc File Ops

Prev: Dired Up: Files

Miscellaneous File Operations

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

   You can use the command `M-x add-name-to-file' to add a name to an
existing file without removing the old name.  The new name must belong
on the file system that the file is on.

   `M-x append-to-file' adds the text of the region to the end of the
specified file.

   `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 overwrites the old contents of the file

   `M-x delete-file' deletes a 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 insert-file' inserts a copy of the contents of a specified file
into the current buffer at point, leaving point unchanged before the
contents and the mark after them.  Note: Mark.

   `M-x make-symbolic-link' reads two file names OLD and LINKNAME, and
then creates a symbolic link named LINKNAME and pointing at OLD.
Future attempts to open file LINKNAME will then refer to the file named
OLD at the time the opening is done, or will result in an error if the
name OLD is not in use at that time.  Confirmation is required if you
create the link while LINKNAME is in use.  Note that not all systems
support symbolic links.

   `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 previous meaning of the name NEW to be
lost.  If OLD and NEW are on different file systems, the file OLD is
copied and deleted.

   `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' reads and displays
one windowful.  You can then type SPC to scroll forward one window, 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
a file for a list of them.  Most commands are the default Emacs cursor
motion commands.  To exit from viewing, type `C-c'.

automatically generated by info2www