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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking for existence of any file in a folder

Status
Not open for further replies.

Steel811

Programmer
Jan 2, 2008
26
US
I have created a script that is triggered by a scheduled task every 15 minutes, and will execute only if there is an input file or multiple files to process in a specific folder. If it finds any amount of files in the folder, it will process it normally. If it doesn't, it will write an error to the log. Does anyone know how to script out that if any txt files exist in a specific folder (e.g. c:\sys), perform some action, otherwise error out?

Any help is appreciated.
Sheel
 
Take a look at the FileSystemObject, the Folder object and it's .Files collection. That should point you in the direction of being able to determine if a file is present.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top