files Module

Some routines to deal with files

Todo

rm -rf dir-name


Uses

  • module~~files~~UsesGraph module~files files module~data_arch data_arch module~files->module~data_arch module~miscellaneous miscellaneous module~files->module~miscellaneous iso_fortran_env iso_fortran_env module~data_arch->iso_fortran_env module~miscellaneous->module~data_arch

Used by

  • module~~files~~UsedByGraph module~files files program~test_files test_files program~test_files->module~files

Functions

public function dir_separator()

Function that returns the system directory separator

Arguments

None

Return Value character(len=1)

public function dirname(file_path)

Subroutine that keeps only the directory from a file path

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_path

Return Value character(len=:), allocatable

public function filename(file_path)

Subroutine that keeps only the file from a path

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_path

Return Value character(len=:), allocatable

public function is_linux()

Function that returns true if the operating system is linux

Arguments

None

Return Value logical(kind=4)

public function str_remove_chars(string, chars)

Function that removes the characters of a string from another string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

string to be modified

character(len=*), intent(in) :: chars

list of characters to remove

Return Value character(len=:), allocatable

returned string

public function str_replace(string, old_str, new_str, place)

Function that replaces a string with another string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

string to be modified

character(len=*), intent(in) :: old_str
character(len=*), intent(in) :: new_str
integer(kind=I4), intent(in) :: place

Return Value character(len=:), allocatable

returned string


Subroutines

public subroutine clean_scratch()

Subroutine that removes all files with extension .scratch

Arguments

None

public subroutine list_dirs(str)

Subroutine that returns a list of subdirectories

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in), optional :: str

public subroutine list_files(dir, list, ext)

Subroutine that returns a list of files in a directory

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: dir
character(len=512), intent(out), allocatable, dimension(:) :: list
character(len=*), intent(in), optional :: ext

public subroutine make_path(wkd, file_path, exit_status)

Subroutine that creates the folders of a file path

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: wkd
character(len=*), intent(in) :: file_path
integer(kind=I4), intent(out) :: exit_status

public subroutine mkdir(wkd, directory, sep, exit_status)

Subroutine that creates a directory

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: wkd
character(len=*), intent(in) :: directory
character(len=1), intent(in) :: sep
integer(kind=I4), intent(out) :: exit_status

public subroutine path2vec(file_path, vec_path)

Subroutine that creates a vector containing the folders of a file path

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_path
character(len=512), intent(out), dimension(:), allocatable :: vec_path

public subroutine vec2path(file_path, vec_path)

Subroutine that creates a path from vector of folders

Arguments

Type IntentOptional Attributes Name
character(len=:), intent(out), allocatable :: file_path
character(len=512), intent(in), dimension(:) :: vec_path