diff options
-rw-r--r-- | src/connection.lisp | 21 | ||||
-rw-r--r-- | src/package.lisp | 2 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index d051ad6..68a1404 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -542,12 +542,25 @@ subclass to the :HOSTATTRS subroutine of properties calling this." (alet (sh-escape (drop-trailing-slash (unix-namestring directory))) (mrun (format nil "rm -rf -- ~A/* ~A/.[!.]* ~A/..?*" it it it)))) +(defun remote-test-multiple (operator paths connective) + (apply #'remote-test (loop for path on paths + nconc (list operator (car path)) + when (cdr path) collect connective))) + (defun remote-exists-p (&rest paths) - "Does each of PATHS exists? + "Does each of PATHS exist? PATH may be any kind of file, including directories." - (apply #'remote-test (loop for path on paths - nconc (list "-e" (car path)) - when (cdr path) collect "-a"))) + (remote-test-multiple "-e" paths "-a")) + +(defun remote-exists-every-p (&rest paths) + "Does each of PATHS exist? +PATH may be any kind of file, including directories." + (remote-test-multiple "-e" paths "-a")) + +(defun remote-exists-some-p (&rest paths) + "Do any of PATHS exist? +PATH may be any kind of file, including directories." + (remote-test-multiple "-e" paths "-o")) (defun remote-file-stats (path) "Get the numeric mode, size in bytes, mtime, owner and group of PATH, or NIL if diff --git a/src/package.lisp b/src/package.lisp index db29898..a576d3c 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -188,6 +188,8 @@ #:runlines #:remote-test #:remote-exists-p + #:remote-exists-every-p + #:remote-exists-some-p #:remote-file-stats #:remote-last-reboot #:remote-executable-find |