if folder contains file

Kuniva
05-08-2003, 08:45 AM
Is there a way to know if the folder contains a file, in this case a JPEG file.

Uplink2069
05-08-2003, 08:47 AM
yes, you can use the dir() function to look at a directory using '*.jpg'. If it returns a zero-length string then its empty of jpegs, else the is at least one present

Irotallic
05-08-2003, 08:48 AM
Try this:

If Len(Dir("c:\file.jpg")) <> 0 Then 'Your file excists

DerFarm
05-08-2003, 08:49 AM
Is there a way to know if the folder contains a file, in this case a JPEG file.


Yeah,

http://www.allapi.net/

has a function called GetFiles or something like that. I grabbed it and modified it for my purposes, but my modifications include about 3 jillion private fucntions.

You should be able to get the code from them and modify it easily for your purposes.

Kuniva
05-08-2003, 08:50 AM
Ok thanx m8's

Irotallic
05-08-2003, 08:59 AM
Is there a way to know if the folder contains a file, in this case a JPEG file.


Yeah,

http://www.allapi.net/

has a function called GetFiles or something like that. I grabbed it and modified it for my purposes, but my modifications include about 3 jillion private fucntions.

You should be able to get the code from them and modify it easily for your purposes.

I wouldn't use an API for this, because you can check if a file excist with one simple line of code. Look what I did posted and check what it does... Much easier :)

kleisie
06-10-2003, 03:11 AM
if there is a way to look if a file excists there must also be a way to look if a directory excists can someone tell me how?? and if the directory does not excist it should create it

Iceplug
06-10-2003, 05:24 AM
Once again, use the Dir$ function.
Dir$("C:\Program Files", vbDirectory)
:)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum