ambrevar/shell: Add move-file.

master
Pierre Neidhardt 2020-12-11 20:14:41 +01:00
parent 60131c414b
commit 2f6df66930
1 changed files with 10 additions and 0 deletions

View File

@ -243,3 +243,13 @@ If PARENT-DIRECTORY is not a parent of PATH, return PATH."
(if (eq *readtable* (named-readtables:find-readtable :interpol-syntax))
(named-readtables:in-readtable :standard)
(named-readtables:in-readtable :interpol-syntax)))
(export-always 'move-file)
(defun move-file (source destination)
"`rename-file' does not work cross-device, in particular it does not work on
different Btrfs subvolumes."
(uiop:run-program (list "mv"
;; Use native-namestring in case path contains escaped
;; character, like "\\[".
(uiop:native-namestring source)
(uiop:native-namestring destination))))