GNU Info

Info Node: (emacs)Misc File Ops

(emacs)Misc File Ops


Next: Compressed Files Prev: Comparing Files Up: Files
Enter node , (file) or (file)node

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.

   `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 `?' while
viewing for a list of them.  They are mostly the same as normal Emacs
cursor motion commands.  To exit from viewing, type `q'.  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' (also `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 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 the file name 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
deleted.

   The similar command `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
Windows, this command works only if the file resides in an NTFS file
system.  On MS-DOS, it works by copying the 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 has the consequence of overwriting the
old contents of the file NEW.

   `M-x make-symbolic-link' reads two file names TARGET and LINKNAME,
then creates a symbolic link named LINKNAME, which points at TARGET.
The effect is that future attempts to open file LINKNAME will refer to
whatever file is named TARGET at the time the opening is done, or will
get an error if the name TARGET is not in use at that time.  This
command does not expand the argument TARGET, 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; on systems that
don't support them, this command is not defined.


automatically generated by info2www version 1.2.2.9