- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried to use RENAME and RENAMEFILEQQ but failed. My code is pasted bellow. Please help me.
!use RENAME to rename some files
program main
use ifport
use ifcore
implicit none
logical::result,alive
character(len=72)::n,oldname,newname
integer::i,istatus
do i=1,10
select case(i)
case(1:9)
write(n,"('0',I1)") I
case(10:40)
write(n,"(I2)") I
end select
write(oldname,*)'la',trim(n)
write(newname,*)'la',trim(n),'.eq'
!result=renamefileqq(oldname,newname)
inquire(file=oldname,exist=alive)
if(alive==0)then
write(*,*) oldname," does not exist"
exit
end if
istatus=rename(oldname,newname)
!----------------------------
!or I use this line instead of the above one
!result=renamefileqq(oldname,newname)
!-----------------------------------
end do
stop
end
I tried to use RENAME and RENAMEFILEQQ but failed. My code is pasted bellow. Please help me.
!use RENAME to rename some files
program main
use ifport
use ifcore
implicit none
logical::result,alive
character(len=72)::n,oldname,newname
integer::i,istatus
do i=1,10
select case(i)
case(1:9)
write(n,"('0',I1)") I
case(10:40)
write(n,"(I2)") I
end select
write(oldname,*)'la',trim(n)
write(newname,*)'la',trim(n),'.eq'
!result=renamefileqq(oldname,newname)
inquire(file=oldname,exist=alive)
if(alive==0)then
write(*,*) oldname," does not exist"
exit
end if
istatus=rename(oldname,newname)
!----------------------------
!or I use this line instead of the above one
!result=renamefileqq(oldname,newname)
!-----------------------------------
end do
stop
end
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the documentation rename expects a full path.
I replaced your case and internal writes with
write(oldname,'(a,i2.2)') 'la',i
write(newname,'(a,i2.2,a)') 'la',i,'.eq'
and used RenameFileQQ and it worked ok
Les

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page