]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.util
copy: Automatically create target directory when copying files
[people/ms/network.git] / src / functions / functions.util
index 0201d0286d41224b6275b833319150081428837c..58afa938a7249deb33dccf83a2f117802537d53c 100644 (file)
@@ -873,6 +873,11 @@ copy() {
                return ${EXIT_ERROR}
        fi
 
+       # Create destination directory if it doesn't exist, yet
+       if ! make_parent_directory "${dst}"; then
+               return ${EXIT_ERROR}
+       fi
+
        if ! fread "${src}" > "${dst}"; then
                log ERROR "Could not copy data from ${src} to ${dst}"
                return ${EXIT_ERROR}