Added -ow option which allows for automatic overwriting

This commit is contained in:
Alex Selimov 2020-01-28 10:59:49 -05:00
parent 9ebdfff0a1
commit a942b8e2a1
4 changed files with 28 additions and 4 deletions

View file

@ -9,7 +9,7 @@ module io
integer :: outfilenum = 0, infilenum = 0
character(len=100) :: outfiles(10), infiles(10)
logical :: force_overwrite
public
contains
@ -38,7 +38,7 @@ module io
!Check to see if file exists, if it does then ask user if they would like to overwrite the file
inquire(file=trim(temp_outfile), exist=file_exists)
if (file_exists) then
if (file_exists.and.(.not.(force_overwrite))) then
if (overwrite == 'r') print *, "File ", trim(temp_outfile), " already exists. Would you like to overwrite? (Y/N)"
read(*,*) overwrite
if((scan(overwrite, "n") > 0).or.(scan(overwrite, "N") > 0)) then