read the list of files contained in a zip archive - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : File Manipulation : FileTools : FileTools/Compressed/Contents

FileTools[Compressed][Contents] - read the list of files contained in a zip archive

Calling Sequence

Contents(file)

Parameters

filename

-

string (zip archive filename)

Description

• 

The Contents command reads the index of a zip file archive and returns a list of strings representing the names of the files contained in that archive.

• 

The list returned does not include the zip file name.  To read each member, L[i] returned in the contents list, use FileTools:-Compressed:-ReadFile( L[i] in zipfilename, options ).

• 

This command only works on zip files.  Files in gzip format do not contain sub-files.

• 

The filename option must be a string, not an open file handle, and not a subfile in zipfile member reference.

Examples

zipfile := FileTools[TemporaryFilename](cat(FileTools[TemporaryDirectory](),kernelopts(dirsep),"Ziptest-"));

zipfile:=/mnt/tmpfs/mpldoc_slot1/mpldoc1/Ziptest-yYoYxV9R

(1)

FileTools[Compressed][WriteFile]("first" in zipfile, "a 1st file");

10

(2)

FileTools[Compressed][WriteFile]("second" in zipfile, "a 2nd file");

10

(3)

L := FileTools[Compressed][Contents](zipfile);

L:=first,second

(4)

[seq( FileTools:-Compressed:-ReadFile(F in zipfile, string), F in L)];

a 1st file,a 2nd file

(5)

FileTools[Remove](zipfile);

See Also

FileTools[Compressed], FileTools[Compressed][Close], FileTools[Compressed][Open], FileTools[Compressed][Write], FileTools[Compressed][WriteFile]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam