Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to create multiple folder using a loop

Status
Not open for further replies.

vibhava

Programmer
Apr 20, 2008
19
US
one last small thing that i want to do:
i want to creat different folders to save these files. the steps i want to follow are;
step 1: start a loop from 1 to 50 (n)
step 2: create a folder named run(n) example if n = 3 it should make three folders run(1),run(2),run(3)

right now i am trying the folowing code but instead of passing on the value of counter I am getting this:
Do c = 1,50
Inquire(file='C:\WAMView\bnz\WAMSA\run(c)',EXIST=FEXIST)
if(.not.FEXIST) then
res=MAKEDIRQQ('C:\WAMView\bnz\WAMSA\run(c)')
Endif
End Do

do you have some solution for my problem.

vibhava
 
I never used inquire, but it seems that your problem is that you didn't convert the number to a string.

try

CHARACTER*2 :: ch
...

WRITE(ch,c)
(maybe you need to give a format like I2.0 or so)
...

INQUIRE(file='C:\WAMView\bnz\WAMSA\run('//ch//')',EXIST=FEXIST)

Gerrit
 
Sorry I think

"WRITE(ch,c)" SHOULD OF COURSE BE "WRITE(ch,I2)c"

Otherwise there's no place for the format :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top