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\
  • 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. – DoMiNeLa10 Feb 22 '18 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. – Dieter.Wilhelm Feb 22 '18 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 Feb 22 '18 at 16:33
3
  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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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