Jump to content

Verificar Pasta vazia


vieirasoft

Recommended Posts

Bom dia. Necessitava de saber o seguinte:

Tenho uma pasta chamada "Documentos" em c:\.meuprograma\minha pasta. Tenho pesquisado e só encontro código para verificação de ficheiros, mas o que eu pretendia era ao clicar num botão que me retornasse se a pasta está vazia ou não, independentemente do facto de ter ou não documentos dentro.

Muito grarto a quem possa ajudar

Link to comment
Share on other sites

Não trabalho com access mas parece ser possível fazer assim:

 

Function Count_Files(strFolder as String) as Long

On Error Goto Error_Handler

Dim file_count as Long
Dim file_name as String

file_name = Dir(strFolder)
file_count = 0

Do While file_name <> ""

file_count = file_count + 1
file_name = Dir

Loop

Count_Files = file_count

Exit Function

Error_Handler:
Debug.Print Err.Description

Count_Files = -1

Exit Function 

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.