Thread: copying files
View Single Post
  #7 (permalink)  
Old 11-03-2005, 02:57 PM
aca parmakovic
Guest
 
Posts: n/a
Default Re: copying files

Alexander Slanina wrote:
> Hi folks !
>
> End of my wits
>
> My fortran program produces 4 log-files. After these files are closed
> i want them to have other filenames, like old_name + date + time +
> ".log".



Call this subroutine ('filename_date_time ') for your log-files (after
log-files are closed):

subroutine filename_date_time (NameFile, ierr)
use dfwin, only: MoveFile
implicit none
character(*), intent(in):: NameFile !log file name - without '.log'
integer, intent(out):: ierr
character(8):: date
character(10):: time
call date_and_time(date, time)
ierr=
MoveFile(NameFile//'.log.'//char(0),NameFile//date//time//'.log'//char(0))
endsubroutine

It will work under Windows. For Unix, you write own MoveFile wrapper
function (use 'rename').

--
Aca.


Reply With Quote