How to rename a file?
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
How to rename a file?
How to rename a file? For some reason it does not work. Surprised myself
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to rename a file?
Code: Select all
CLoseAll() // Закрытие всех баз данных с ожиданием завершения операций
DIRCHANGE(M_PathAppl) // Перейти в папку текущего приложения
IF FILE('Rasp.dbf')
ERASE('Rasp.dbf')
ENDIF
mNameRsp = 'Rasp_'+LOWER(Ar_Model[mNumModel])+'.dbf'
* RENAME FILE (mNameRsp) TO ('Rasp.dbf')
COPY FILE (mNameRsp) TO ('Rasp.dbf')
Re: How to rename a file?
I use Frename() function.
It requires a full path name for both arguments.
It requires a full path name for both arguments.
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: How to rename a file?
Thank You, Roger! So it seems to work:[/size]
Code: Select all
CLoseAll() // Закрытие всех баз данных с ожиданием завершения операций
DIRCHANGE(M_PathAppl) // Перейти в папку текущего приложения
mNameRspOld = M_PathAppl+'Rasp_'+LOWER(Ar_Model[mNumModel])+'.dbf'
mNameRspNew = M_PathAppl+'Rasp.dbf'
IF FILE(mNameRspNew)
ERASE(mNameRspNew)
ENDIF
FRENAME(mNameRspOld,mNameRspNew)
Re: How to rename a file?
I am using this , with 10 attempts ,if it fails for the first time :
Code: Select all
deletefile(cestatlac+"Supis_C_Parciel.pdf")
FRename((cestatlac+"RauknReport.pdf"),(cestatlac+"Supis_C_Parciel.pdf"))
pokus:=1
do while file((cestatlac+"Supis_C_Parciel.pdf"))!=.T. .and. pokus<10
sleep(300)
FRename((cestatlac+"RauknReport.pdf"),(cestatlac+"Supis_C_Parciel.pdf"))
pokus++
enddo