(dired.info)Copy and Move Into a Directory


Next: Renaming and More With Regexps Prev: Mark-using Commands Up: Mark-using Commands

Copy, Move etc. Into a Directory
--------------------------------

This section explains commands that create a new file for each marked
file, for example by copying (`c') or moving (`r') files.  They prompt
in the minibuffer for a TARGET argument, usually the target directory
in which the new files are created.  But if there is but one marked
file, the target may also be a plain file.  (Otherwise you could not
simply rename or copy a single file within the same directory.) Even
with one marked file the target may still be an (existing) directory.

   The target prompt displays a "default target" that will be used if
you just type `RET'.  Normally the default target is the current Dired
directory, so if you want to copy into some specific subdirectory, move
point into that subdirectory before typing `c'.  But if there is a
Dired buffer in the next window, and `dired-dwim-target' is true, its
current Dired directory is used.  This makes it easy to copy from one
Dired buffer into another if both are displayed.  On the other hand you
have to use `C-x 1' to make other Dired buffers vanish if you do not
want to have them as default targets.  To make Dired never look at the
next window, set the variable `dired-dwim-target' to nil (`dwim' means
Do What I Mean).  Note: Dired User Options, on how to set
cutomization variables.

   As a general rule, Dired will not let you remove or overwrite a file
without explicit confirmation.  Dired asks you for each existing target
file whether or not to overwrite just this file (answer `y' or `n') or
all remaining files (answer `!').  You can also type your help
character, usually `C-h', at that time for help.

`c'
     (`dired-do-copy') Copy the marked (or next N) files into a
     directory, or copy a single file.

     Thus, a zero prefix argument (N-0) copies nothing.  But it toggles
     the variable `dired-copy-preserve-time'.
     Note: Dired User Options, on how to set customization variables.

`r'
     (`dired-do-move') Move the marked files into a directory.  If
     there is just one marked file, rename that file.  As the marked
     files default to the current file, this can also be used to simply
     rename the current file.

     Dired silently changes the visited file name of buffers associated
     with moved files so that they refer to the new location of the
     file.

     When a directory is renamed, its headerlines in Dired buffers are
     updated, and any buffers visiting affected files have their
     visited file name changed to refer to the new location.  Their
     buffer name is changed if no buffer with such a name already
     exists.  Affected files are all those which contain the directory
     somewhere in their absolute path name.

     A zero prefix arguments does not move any files, but toggles the
     variable `dired-dwim-target'.

`H'
     (`dired-do-hardlink') Make hard links from the target directory to
     each marked file.

`Y'
     (`dired-do-symlink') Make symbolic links from the target directory
     to each marked file.

   Linking is very similar to copying in that new files are created
while the old files stay.  If you want each newly copied or linked file
to be marked with the same marker that its original has, set the
variables `dired-keep-marker-copy', `dired-keep-marker-hardlink' or
`dired-keep-marker-symlink' to `t'.  Set them to `nil' to not give
these newly created files marks.  The default is to mark them with `C',
`H' and `Y', respectively.

   Moving differs from copying and linking in that the old file is
removed as part of the creation of the new file.  Thus it makes sense
to set the variable `dired-keep-marker-move' to `t' (the default) so
that moved files "take their markers with them".


automatically generated by info2www