Retornar o caminho completo de um diretório ou arquivo contidos em uma lista pré-carregada em memória pela função LOG_file_getListCount(), contendo todos os diretórios e/ou arquivos existentes de um determinado caminho do disco local ou servidor.

Sintaxe

LOG_file_getFromList( < l_ind >) => VARCHAR

Parâmetros

Nome

Tipo

Obrigatório?

Descrição

l_ind

INTEGER

Sim

Índice de busca do diretório ou arquivo dentro da lista carregada pela função LOG_file_getListCount (atual).

Retorno

Tipo

Descrição

VARCHAR

Caminho completo do diretório ou arquivo correspondente ao índice informado.

Exemplo

DEFINE ma_files ARRAY[] OF RECORD
                filetype  CHAR(01),
                filename  CHAR(100)
                END RECORD

#--------------------------------#
 FUNCTION LOG_fileFromList_test()
#--------------------------------#
  DEFINE l_file_name CHAR(250)
  DEFINE l_ind       SMALLINT
  DEFINE l_count     SMALLINT
  DEFINE l_total     SMALLINT
  DEFINE l_drive, l_path, l_name, l_extension CHAR(100)

  LET l_total = LOG_file_getListCount("c:\\temp\\","*.txt",FALSE,TRUE,0)

  FOR l_ind = 1 TO l_total
      LET l_file_name = LOG_file_getFromList(l_ind)

      CALL LOG_file_splithPath(l_file_name) RETURNING l_drive, l_path, l_name, l_extension

      LET l_count = l_count + 1
      CALL ArrayAddItem(ma_files,1)

      LET ma_files[l_count].filename = l_name CLIPPED, l_extension 
      LET ma_files[l_count].filetype = LOG_file_getTypeFromList(l_ind)

      IF ma_files[l_count].filetype = "D" THEN
         CALL conout("Diretório = "||ma_files[l_count].filename)
      ELSE  
         CALL conout("Arquivo = "||ma_files[l_count].filename)
      END IF
  END FOR
END FUNCTION

Informações

Fontes: file.4gl, file.prw

Veja também

LOG_file_splithPath

LOG_file_getListCount (atual)