Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADIR and zip folders...

Status
Not open for further replies.

GriffMG

Programmer
Mar 4, 2002
6,288
1
38
FR
Just had an interesting experience where I couldn't create a folder because ADIR recognises zip archives as folders...

Code:
m.dirs = ADIR(tmpdirs,"d:\$incoming\*.*","D")

Will include d:\$incoming\E7895.zip - even with the "D" flag set.

So my app is looking for an existing folder starting with E7895, and sees the zip
as a directory - but can't write to it!

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Hi,

I can't confirm it.
I did test local hdd and network drive.
ADIR() return "A" attribute for all zip files.

The folder "$incoming" or real folder or not?

MartinaJ

mJindrova
 
Hi Martina

$incoming is a real folder and the attribute isn't what I meant - it's the D flag on ADIR should only return folders (Directories)
and it will treat .zip files as folders probably only since a particular version of windows...

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 

Hi Griff,

VFP Help said:
Including D returns subdirectory names of the current directory in addition to file names that match the file skeleton specified in cFileSkeleton

if you put "D" into cAttribute parameter then ADIR() return files and subfolders.

MartinaJ


mJindrova
 
Also from the help:
help said:
Include an empty string in cFileSkeleton to return just subdirectory names, hidden files or system files.

So to only get directories first change the current directory, then use the empty cFileskeleton and don't include S or H in the attributes.
Code:
CD d:\$incoming
m.dirs = ADIR(tmpdirs,"","D")

I can confirm (at least for me): This way VFP doesn't list a zip file as a directory.

On the other hand, even if you stick to ADIR(tmpdirs,"d:\$incoming\*.*","D") and take into account this has both files and directories, the attributes in the fifth element of the result array rows is including the letter D for directories, but not for zip files, as Martina meant. I can also confirm that. So you can filter the result by that.

Chriss
 
Ah ha, thank you both - always learning new stuff

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
The only downside I see: If you want to include hidden directories, you also include hidden files. I just checked it. That may be an unimportant corner case, but strictly speaking, it means you can only concentrate on directories when you don't care for hidden directories. They don't play a role to me, all hidden directories I have are hidden system directories. Windows makes use of that hidden attribte for some system folders. It's not a big point, but MKDIR will also fail when you try to create a directory with the same name as a hidden directory you overlooked.

I guess it's all about E#### directories in your case, which you create and don't hide, so no problem. It just annoys me now, that even with these exceptions you often find in VFP command options or parameterizations, it covers some but not all corner cases. It might be over in a minute.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top