Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

delete a directory

woshiwuxin
Novice
1,194 Views
Hello!
I'm using the intel fortran compiler. I realize that the subroutine 'PXFMKDIR' can create a directory. Could anyone tell me which subroutine (or function) can delete a directory containing some files?
I just want something different from the 'SYSTEM'-like functions.
Thank you in advance!
0 Kudos
2 Replies
TimP
Honored Contributor III
1,193 Views
It looks like you have the choice between deleting the files first, then deleting the directory by Posix or legacy QQ function calls, or shell commands like SYSTEM("rm -r ....") (soon to be replaced by execute_command_line)
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,193 Views
To add to TimP's comment regarding SYSTEM, or soon to be replaced by execute_command_line, I suggest that the text that you use to provide the command comes from a resource file or "config" file as opposed to being hard coded into the application. The directory delete command name may depend upon the users shell choice (isdirectory delete aDEL, RMDIR, UNLINK, ...?). And as Tim eludes, the directory removal may or may not require pre-deletion of files (assuming none are open) and/or removal from focus by other processes (no other process having current directory as that which you wish to delete). If you want to bullet-proof and future-proof the directory delete operation, these issues, and maybe more, should be addressed.

Jim Dempsey
0 Kudos
Reply