subroutinecopy_path
subroutine copy_path(from, to, stat)
Copy file or directory from to to, with what a directory holds.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| from | character(len=*) | in | the file or directory | |
| to | character(len=*) | in | the copy | |
| stat | integer | out | nonzero on failure |
Calls
Source
Show the code
subroutine copy_path(from, to, stat)
character(len=*), intent(in) :: from !! the file or directory
character(len=*), intent(in) :: to !! the copy
integer, intent(out) :: stat !! nonzero on failure
if (.not. is_directory(from)) then
call copy_file(from, to, stat)
else if (is_windows()) then
call run_command('xcopy '//quoted_path(from)//' '//quoted_path(to)//' /e /i /y /q >nul', stat)
else
call run_command('cp -R '//quoted_path(from)//' '//quoted_path(to), stat)
end if
end subroutine copy_path