Jump to content

Search for directory only


John-Paul
 Share

Recommended Posts

How does one search for a directory only.

ie: if dir exists DIR then ......

I have found the FileExists function and there does not seem to be a Directory Exists and not being too code fantasic I have not found a simply way to do it.

I only want to check if a directoory exists and if so the script will run, if not then the script will exit.

:idiot: Basically I want to back up my files after a certain event (system shutdown) and so I want to see if a previous backed up directory exists then I will rename it by using the Move Dir function as there's no rename function and once moved then continue with backing up the files, plus relabel directory 3 times so that i have 4 backed up versions.

ie:

Backup

Backup_1

Backup_2

Backup_3

Thanks,

Jp

Edited by John-Paul
Link to comment
Share on other sites

Try to use the search functions combined with FileGetAttrib()..

Edit : oops...maybe not exactly what you wanted..

Try something like this :

If FileExists("c:\windows\") Then
MsgBox(64,"","wow!")
Else
MsgBox(64,"","what the..")
Endif

Good luck !

Edited by Helge
Link to comment
Share on other sites

Thanks, and I recognise that I posted it here in the Scripts section and may have placed it in the general section, so hope no one is too upset.

jp.

Try to use the search functions combined with FileGetAttrib()..

Edit : oops...maybe not exactly what you wanted..

Try something like this :

If FileExists("c:\windows\") Then
MsgBox(64,"","wow!")
Else
MsgBox(64,"","what the..")
Endif

Good luck !

<{POST_SNAPBACK}>

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...