CompressFiles

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

Post Reply
claudiotedesco
Posts: 131
Joined: Thu Jul 31, 2008 12:05 pm

CompressFiles

Post by claudiotedesco » Wed May 27, 2009 2:28 pm

Hola tenia esto pendiente,
Baje el archivo de "Backup & Restore Dbf Files" y funciona correctamente.

Ahora mi consulta es la siguiente
Estoy usando CompressFiles
Cuando hago copia de los archivos de una carpeta c:\bases por ejemplo me lo comprime correctamente.
Ahora si c:\bases contiene otras carpetas no me lo copia en el ZIP.
Que instrucción tengo que agregar para que copie otras carpetas?
Gracias
Claudio

User avatar
salamandra
Posts: 130
Joined: Thu Jul 31, 2008 8:33 pm
Location: Brazil
Has thanked: 1 time

Post by salamandra » Wed May 27, 2009 5:49 pm

:) Hi claudiotedesco,
claudiotedesco wrote: Ahora si c:\bases contiene otras carpetas no me lo copia en el ZIP.
Que instrucción tengo que agregar para que copie otras carpetas?
Take a look at HMG\SAMPLES\ZIP .OR. try the following code:

// =================================================
#include <minigui.ch>

Function Main()
Local k, aFiles:=Directory("*.dbf","D"), myFiles:={}
If Len(aFiles) <=0
MsgStop("Sorry, wrong path specified or no files to compress !!")
else
For k:=1 to Len(aFiles)
AADD( myFiles, aFiles[k,1] ) // Add FileNames only
Next k
COMPRESS myFiles ;
TO "test00.zip" ;
BLOCK {|| NIL} ; // Use your own Block here
OVERWRITE
endif
Return Nil
// =================================================

For further and detailed information about (x)Hb Function DIRECTORY(), please
refer to (x)Harbour Guide.



Best regards,


Salamandra
There is one time in which is crucial awakening. That time is now. ( Buddha )

claudiotedesco
Posts: 131
Joined: Thu Jul 31, 2008 12:05 pm

Post by claudiotedesco » Thu May 28, 2009 12:16 pm

Hola Salamandra

estuve probando el ejemplo, me guarda en el ZIP los archivos y las carpetas pero no el contenido que hay en ella.
Hay otro opción que agregar?


Hello Salamandra

I was testing your example, I saved in the ZIP files and folders but no content in it.
There is another option to add?

User avatar
salamandra
Posts: 130
Joined: Thu Jul 31, 2008 8:33 pm
Location: Brazil
Has thanked: 1 time

Post by salamandra » Fri Jun 05, 2009 6:04 pm

Hi claudiotedesco,

I was testing your example, I saved in the ZIP files and folders but no content in it.
There is another option to add?
Function DIRECTORY(<cDirSpec>, [<cAttributes>]) returns an array of subarrays, with each
subarray contains information about each file matching <cDirSpec>.

Arguments:

<cDirSpec>
Identifies the drive, directory and file specification for the directory search.
Wildcards (*.*) are allowed in the file specification.


<cAttributes>
Attribute...............Meaning
H..........................Include hidden files
S..........................Include system files
D..........................Include directories
V..........................Search for the DOS volume label and exclude all other files.

** Normal files are always included in the search, unless you specify V.

This is the Returned SubArray Structure:
Position...Metasymbol.....Directry.ch
1.............cName..............F_NAME
2.............cSize................F_SIZE
3.............dDate..............F_DATE
4.............cTime...............F_TIME
5.............cAttributes.......F_ATTR

If no files are found matching <cDirSpec> or if <cDirSpec> is an illegalpath
or file specification, DIRECTORY() returns an empty ({}) array.

Example :

aFiles:=DIRECTORY("C:\MyFiles\*.dbf","D")
(will retrieve ALL *.DBF files in C:\MyFiles including existing directories)

If C:\MyFiles it's not an illegall path .AND. if C:\MyFiles it's not a EMPTY FOLDER,
aFiles will be an Array of of subarrays, which each subarray contains:
NAME, SIZE, DATE, TIME and FILE ATTRIBUTES of each file found matching your criteria.

I use this function to retrieve files (*.*) in folders and works fine for me...

Regards,

Salamandra
There is one time in which is crucial awakening. That time is now. ( Buddha )

Post Reply