File: example_is_symlink.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (20 lines) | stat: -rw-r--r-- 620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
! Demonstrate usage of `is_symlink`
program example_is_symlink
  use stdlib_system, only: is_symlink, is_directory
  implicit none

  character(*), parameter :: path = "path/to/check"

  ! Test if path is a symbolic link
  if (is_symlink(path)) then
    print *, "The specified path is a symlink."
    ! Further check if it is linked to a file or a directory
    if (is_directory(path)) then
        print *, "Further, it is a link to a directory."
    else
        print *, "Further, it is a link to a file."
    end if
  else
    print *, "The specified path is not a symlink."
  end if
end program example_is_symlink