Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
49 Views

Problem with RenameFileQQ

I am using RenameFileQQ to rename a directory.

I have noticed that the documentation only says it renames a file.

I have used the code previously to rename a directory and it works.

use ifport,only:RenameFileQQ
logical*4 lret
lret=RenameFileQQ("c:\Grade\data\TEST","c:\Grade\data\1234")

 

In the previous version that worked, I was using a BrowseForFolder routine but in the new code that doesn't work I'm using a BrowseForFile routine.

The BrowseForFolder routine was from a file CommonDlgXtras.f90 which I got from the forum from John Termine.

The BrowseForFile routine uses GetOpenFileName

The error I get after RenameFileeQQ using GetLastErrorQQ is error 13 ERR$ACCES - Permission denied. The file's permission setting does not allow the specified access

Do you have any suggestions why this is not working? 

 

   

0 Kudos
4 Replies
Highlighted
Employee
49 Views

The documentation does say it renames a file but it is renaming a directory for me with our latest PSXE 2017 Update 1. I need to inquire if that is expected/supported.

What version of our compiler are you using?   

Did you verify the appropriate permissions exist on all components of the path and the directory that is getting renamed?

0 Kudos
Highlighted
Black Belt
49 Views

My guess... GetOpenFileName is changing the current directory to be the same as the directory you are trying to rename.

0 Kudos
Highlighted
Beginner
49 Views

Kevin,

The compiler is Intel(R) Visual Fortran Compiler XE 12.1.4.325

Ian,

Your guess was correct - I reset the current directory and it worked.

Thank you

0 Kudos
Highlighted
Employee
49 Views

Thank you for the version id. Glad you resolved it. I'm told RENAMEFILEQQ will work for folders/directories too but it is odd seeing MAKEDIRQQ, DELDIRQQ, CHANGEDIRQQ but no "RENAMEDIRQQ". I will follow up w/the documentation writers about adding clarification.

0 Kudos