Do you know about default-directory variable in Emacs Lisp?
October 08, 2023
(buffer-file-name) ;; "/home/tony/minibuffer/notes.el"
default-directory ;; "/home/tony/minibuffer/"
(copy-directory "~/minibuffer/foo/" "./bar/")
(let ((default-directory "/tmp/"))
(copy-directory "~/minibuffer/foo/" "./bar/" nil t))
◉ tony@tony:~/minibuffer:
$ tree
.
├── bar
├── foo
│ ├── foo-1
│ └── foo-2
├── #notes.el#
└── notes.el
2 directories, 4 files
◉ tony@tony:~/minibuffer:
$ tree
.
├── bar
│ └── foo
│ ├── foo-1
│ └── foo-2
├── foo
│ ├── foo-1
│ └── foo-2
├── #notes.el#
└── notes.el
3 directories, 6 files
◉ tony@tony:~/minibuffer:
$ rm -r bar/*
◉ tony@tony:~/minibuffer:
$ tree
.
├── bar
├── foo
│ ├── foo-1
│ └── foo-2
├── #notes.el#
└── notes.el
2 directories, 4 files
◉ tony@tony:~/minibuffer:
$ tree /tmp/bar/
/tmp/bar/
└── foo
├── foo-1
└── foo-2
1 directory, 2 files
◉ tony@tony:~/minibuffer:
$