I often make the mistake of creating a directory instead of a file in Dired (by hitting +). I then have to delete it and recreate the file, with the same name.

Sometimes, I tried to edit the d file type attribute (with Ctrl x - Ctrl q)

total used in directory 8.0K available 20.3 GiB
drwxrwsr-x 2 smonff users   6 Aug 17 18:41 demand.t
-rw-rw-r-- 1 smonff users 170 Aug 17 11:33 user.t
-rw-rw-r-- 1 smonff users 838 Aug 17 18:04 location.t

...but I am not aware of a way to edit the files attributes, Emacs says that they are read-only, even after turning to Editable Dired mode

  • 2
    You want dired-mode to help you convert a directory into a file? I could be wrong, but the usual method is to delete the unwanted directory and then create a new file in separate actions.
    – lawlist
    Aug 17, 2022 at 17:07
  • 2
    So write a command that deletes the directory (if it is empty) and creates a zero-length file of the same name, and bind it to a key (or do it with a keyboard macro if you don't want to write Lisp).
    – NickD
    Aug 17, 2022 at 18:02
  • What both @lawlist and NickD said.
    – Drew
    Aug 17, 2022 at 23:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.