Sign in to follow this  
Followers 0
John-Paul

Search for directory only

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

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

Share this post


Link to post
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}>

Share this post


Link to post
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
Sign in to follow this  
Followers 0