Variable: dired-create-destination-dirs-on-trailing-dirsep

dired-create-destination-dirs-on-trailing-dirsep is a customizable variable defined in dired-aux.el.gz.

Value

nil

Documentation

If non-nil, consider a file name ending in a slash as a directory to create.

If this variable is non-nil and a single destination file name of a Dired command ends in a directory separator (/), that file name will be treated as a non-existent directory, and that directory will be created if the variable dired-create-destination-dirs says so.

For example, if both dired-create-destination-dirs and this option are non-nil, renaming a directory named old_name to new_name/ (note the trailing directory separator) will create new_name if it does not already exist, and will move old_name into it. By contrast, if only new_name
(without the trailing /) is given, or this option or
dired-create-destination-dirs is nil, old_name will be renamed to new_name.

This variable was added, or its default value changed, in Emacs 29.1.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
(defcustom dired-create-destination-dirs-on-trailing-dirsep nil
  "If non-nil, consider a file name ending in a slash as a directory to create.

If this variable is non-nil and a single destination file name of
a Dired command ends in a directory separator (/), that file name
will be treated as a non-existent directory, and that directory
will be created if the variable `dired-create-destination-dirs'
says so.

For example, if both `dired-create-destination-dirs' and this
option are non-nil, renaming a directory named `old_name' to
`new_name/' (note the trailing directory separator) will
create `new_name' if it does not already exist, and will
move `old_name' into it.  By contrast, if only `new_name'
(without the trailing /) is given, or this option or
`dired-create-destination-dirs' is nil, `old_name' will be
renamed to `new_name'."
  :type '(choice
          (const :tag "Create directories when destination ends in a slash" t)
          (const :tag "Do not create destination directories" nil))
  :group 'dired
  :version "29.1")