Página 1 de 1

Comando para criar pasta(dir) no xHarbour

Enviado: 24 Jul 2023 14:47
por Kapiaba
Boa tarde senhores, alguém sabe o Comando para criar pasta(dir) no xHarbour modo console? Tipo: LMKDIR()?

Obg. abs.

Regards, saludos.

Comando para criar pasta(dir) no xHarbour

Enviado: 24 Jul 2023 16:05
por Itamar M. Lins Jr.
Olá!
Do clipper ?
MakeDir()

Saudações,
Itamar M. Lins Jr.

Comando para criar pasta(dir) no xHarbour

Enviado: 24 Jul 2023 16:07
por Itamar M. Lins Jr.
Olá!
Nam forum
ft_MkDir()
CaTools
DirMake()

Saudações,
Itamar M. Lins Jr.

Comando para criar pasta(dir) no xHarbour

Enviado: 24 Jul 2023 17:38
por alxsts
Olá!

Extraído do xHarbour Language Reference Guide
MakeDir()

Creates a new directory.

Syntax
MakeDir( <cDirectory> ) --> nOSError

Arguments
<cDirectory>
A character expression specifying the directory to create. The directory can be specified relative to the current directory, or absolute, including a drive letter followed by a colon.

Return
The function returns a numeric value representing the operating system error code (DOS error). A value of 0 indicates a successful operation.

Description
The function attempts to create the directory specified with <cDirectory>. If this operation fails, the function returns the OS error code indicating the reason for failure. See the FError() function for a description of OS errors.
Note that <cDirectory> cannot contain subdirectories more than one level deep.

Info
See also: DirChange(), DirRemove(), DiskChange(), DiskName(), FError(), IsDisk()
Category: Directory functions , File functions
Source: rtl\dirdrive.c
LIB: xhb.lib
DLL: xhbdll.dll

Example

Código: Selecionar todos

// The example demonstrates how to create nested sub-directories
// in the current directory

   PROCEDURE Main
      LOCAL i, j, aSubDir, cSubDir, nError
      LOCAL aNewDir := { ;
         "payments\salaries"  , ;
         "payments\purchases" , ;
         "customer\marketing" , ;
         "customer\orders"    , ;
         "customer\support"     }

      FOR i:=1 TO Len( aNewDir )
         cSubDir := CurDrive()+ ":\" + CurDir() + "\"
         aSubDir := HB_ATokens( aNewDir[i], "\" )

         FOR j:=1 TO Len( aSubDir )
            cSubDir += aSubDir[j] + "\"

            nError := MakeDir( cSubDir )
            IF nError == 0
               ? "Directory", cSubDir, "successfully created"
            ELSEIF nError == 5
               ? "Directory", cSubDir, "exists already"
            ELSE
               ? "Error for", cSubDir, LTrim( Str( nError ) )
            ENDIF
         NEXT j
      NEXT i

   RETURN

Comando para criar pasta(dir) no xHarbour

Enviado: 25 Jul 2023 11:28
por Paredes01
Para mi funciona bien:

If !IsDirectory("C"+":\TmpPDF")
MakeDir("C"+":\TmpPDF")
Endif

Saludos!!

Comando para criar pasta(dir) no xHarbour

Enviado: 25 Jul 2023 14:46
por Kapiaba
Muito obrigado. Funcionou perfeito! Gracias Paredes.

Código: Selecionar todos

FUNCTION Main()

   IF !IsDirectory( "C" + ":\TmpPDF" )

      MakeDir( "C" + ":\TmpPDF" )

   ENDIF

RETURN NIL
Estou reaprendendo Modo Console. O que a gente não faz por dinheiro. hahahaha.

Super many thanks.

Regards, saludos.

João Santos - São Paulo.

Comando para criar pasta(dir) no xHarbour

Enviado: 25 Jul 2023 16:22
por alxsts
Olá!
Kapiaba escreveu:Estou reaprendendo Modo Console
Isto vale para modo console (texto), gráfico, DOS, Windows, Linux...

Comando para criar pasta(dir) no xHarbour

Enviado: 26 Jul 2023 12:50
por Kapiaba
Obrigado Alexandre Santos (AlxSts). uso FIVEWIN, e ele tem comando próprio para isso.

Obg. abs.

Regards, saludos.

Comando para criar pasta(dir) no xHarbour

Enviado: 04 Ago 2023 10:04
por clodoaldomonteiro
Olá!
Neste manual tem muita coisa q pode te ajudar.