diff options
Diffstat (limited to 'funzip.f90')
-rw-r--r-- | funzip.f90 | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/funzip.f90 b/funzip.f90 new file mode 100644 index 0000000..dc71e84 --- /dev/null +++ b/funzip.f90 @@ -0,0 +1,37 @@ +program funzip +use m_unzip +implicit none + + character(len=512)::archive, dir + logical::success, file_exists + + success = .false. + + if(command_argument_count() < 1 .or. command_argument_count() > 2) then + + call get_command_argument(0, archive) + Print *, "Usage: "//trim(archive)//" <zip file> [<destination directory>]" + + else + + call get_command_argument(1, archive) + if(command_argument_count() == 2) then + call get_command_argument(2, dir) + else + dir = "." + end if + + inquire(file=trim(archive), exist=file_exists) + if(.not. file_exists) then + Print *, "Could not locate '"//trim(archive)//"'" + end if + + if(unzip(trim(archive), trim(dir), indexed='/tmp/zip.lst')) then + + Print *, "Successfully extracted '"//trim(archive)//"'" + + end if + + end if + +end program funzip |