Makeing a new directory if one does not exist

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 161
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 47 times
Been thanked: 7 times

Makeing a new directory if one does not exist

Post by bluebird » Fri Apr 05, 2019 5:16 am

Dear mentors

How can I implement this pseudo code in HMG

cDir:="C:\HMGSave"

If .NOT. exist cDir
Create Folder // this is already in HMG
Else
msgstop ("I found one called HMGSave already")

Endif

Its the exitance check that I can't find

Thank you

User avatar
bpd2000
Posts: 1057
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 191 times
Been thanked: 87 times

Post by bpd2000 » Fri Apr 05, 2019 5:35 am

visit
https://vivaclipper.wordpress.com/2014/01/09/makedir/
cDir := "temp"
IF MakeDir( cDir ) == 0
? "Directory", cDir, "successfully created"
ENDIF
BPD
Convert Dream into Reality through HMG

User avatar
SALINETAS24
Posts: 298
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Has thanked: 10 times
Been thanked: 16 times

Post by SALINETAS24 » Fri Apr 05, 2019 6:02 am

Code: Select all

Local cDirFoto:=GetCurrentFolder()+"\Fotos\"   // -> Este será para guardar las fotos
//-> Si no existe el directorio de FOTOS lo creo
IF !HB_DirExists(cDirFoto)
		MakeDir(cDirFoto)
ELSE
                msgstop ("YA EXISTE")
ENDIF

Post Reply