1

What is the function to move files? I want to emulate the following shell command:

mv file dir

As described here, the closest is rename-file, but this would be emulating this:

mv file newfile
4

That function can actually move files to directories, but its documentation was not in accord with its features. If the destination ends in a /, then the file is moved. e.g.

(rename-file "foo" "bar/")

will move foo into the directory bar.

| improve this answer | |
  • is a slash portable? How to build a dirname from a string in a portable way? – blueFast Jul 24 '18 at 7:53
  • 1
    (file-name-as-directory "bar") is the portable way to do that. – rpluim Jul 24 '18 at 9:41
  • OP: Please consider accepting this answer. I believe it's what you're looking for. – Drew Nov 10 '18 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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