展开全部
PROGRAM Main
USE IFPORT !需要调用IFPORT模块。
IMPLICIT NONE
INTEGER :: FEXIST, RES, STATUS
CHARACTER(len=200) ::folder_name
CHARACTER(len=200) ::command
folder_name = './test_folder/'
! check if the folder exist, if not, creat it
!if yes, remove it
INQUIRE(DIRECTORY=TRIM(folder_name),EXIST=FEXIST)
IF(.not.FEXIST) THEN
WRITE(*,*) 'The folder does not existing, now create it...'
res=MAKEDIRQQ(TRIM(folder_name))
IF (res) THEN
WRITE (*,*) 'New directory successfully created'
ELSE
WRITE (*,*) 'Failed to create directory'
END IF
ELSE
WRITE(*,*) 'The folder already exist. Now reomove it...'
res = DELDIRQQ (TRIM(folder_name))
IF (res) THEN
WRITE (*,*) 'A directory successfully removed.'
ELSE
WRITE (*,*) 'Failed to remove a directory'
END IF
ENDIF
END
USE IFPORT !需要调用IFPORT模块。
IMPLICIT NONE
INTEGER :: FEXIST, RES, STATUS
CHARACTER(len=200) ::folder_name
CHARACTER(len=200) ::command
folder_name = './test_folder/'
! check if the folder exist, if not, creat it
!if yes, remove it
INQUIRE(DIRECTORY=TRIM(folder_name),EXIST=FEXIST)
IF(.not.FEXIST) THEN
WRITE(*,*) 'The folder does not existing, now create it...'
res=MAKEDIRQQ(TRIM(folder_name))
IF (res) THEN
WRITE (*,*) 'New directory successfully created'
ELSE
WRITE (*,*) 'Failed to create directory'
END IF
ELSE
WRITE(*,*) 'The folder already exist. Now reomove it...'
res = DELDIRQQ (TRIM(folder_name))
IF (res) THEN
WRITE (*,*) 'A directory successfully removed.'
ELSE
WRITE (*,*) 'Failed to remove a directory'
END IF
ENDIF
END
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询