2

Windows 10, Emacs 25.1, Dired+

Suppose I has folder

d:\TEMP\test\com\myproject\android\common\

Here: enter image description here

I want in dired mode by one step to rename full path to net\newproject\iphone\data. So as result I want to get the next path:

d:\TEMP\test\net\newproject\iphone\data\
3
  • 2
    You could go up a directory, and move this directory where you want it to be, just like you'd rename any other file.
    – user12563
    Commented Feb 22, 2018 at 13:42
  • @DoMiNeLa10 but you'd have to do it sequentially, first going up and mv'ing common to data (e.g. with the R key) and then further going up mv'ing android to iphone. Commented Feb 22, 2018 at 14:47
  • 2
    This is an interesting idea, but I don't think Dired does this out of the box. Though it could probably be extended to do that. I'll see Sunday, if I can add something like this.
    – wvxvw
    Commented Feb 22, 2018 at 16:33

1 Answer 1

2
  1. As @DoMiNeLa10 said in a comment:

    You could go up a directory, and move this directory where you want it to be, just like you'd rename any other file.

    That's really the answer.

  2. You can actually do what you suggest, at least on MS Windows, which uses ls-lisp.el (you might try it on other platforms too, after loading that library). It works, even with emacs -Q (no init file), i.e., with vanilla Dired.

    To do this, put your cursor on the current directory line in Dired, which is shown as . or ./ depending on your ls switches.

    However, you get an error message, even though the directory does get moved (renamed) as you expect. The error message says this, if the Dired listing is for /some/dir1/dir2/ccc/:

     Expected to find /some/dir1/dir2/ccc/./ in headerline of /some/dir1/dir2/ccc/
    

    There is an Emacs bug here, it seems, but the operation does seem to work OK. I've submitted bug #30578 for this.

    See the Emacs manual, node ls in Lisp, for information about using library ls-lisp.el, if you are not on MS Windows.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.