Scripting question

Hello All,

I just want to say off the bat that I am new to the Level Platform systems, and also very new to attempting scripts. I have been tasked to see if it is possible to set up a script for LP that would also trigger an alert to let us know when a file was found in a directory.

Here is the situation:
I would like to design the script to search a directory for a specific file ext, which is .spi.
Inside this directory, there are quite a few .spi files, but some have CD in the file name which we do not care to see in our results.
Once the script has locates the new .spi file that was created from a back up we would like it to trigger an alert for us to see.

What I have so far (its not much). After many google searches I came accross the below script and just through my information into it to see if I could get it to work. Which it does. It finds the file and generates the report to my desktop. It finds the 2 .spi files I have put there. The problem is, one of those has "CD" in it, and that is what I would like to exclude. The end result would be to have the report really be an alert in LP.
@EcHO OFF
(for /R "c:\users\kbosse\desktop" %%F in ("*.spi") do echo %%~fF,%%~zF)>c:\users\kbosse\desktop\report.csv

I have read a little bit about 'grep' but from my understanding that's not really a windows thing?


I would like to think I'm on the right path, but with my lack of experience of scripting, I'm trying to learn on the fly.
Does any of this sound possible?

Ken
fballatoreAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GillesTCommented:
Try this script :

@echo off
@setlocal enableextensions enabledelayedexpansion

set thepath="c:\users\kbosse\desktop"
set stringtoexclude="CD"
set fileredirec="c:\users\kbosse\desktop\report.csv"

(
for /R %thepath% %%F in ("*.spi") do (
set thefile=%%F

echo !thefile! | findstr /C:%stringtoexclude% 1>nul
if errorlevel 1 (
      echo %%~fF,%%~zF
)
)
) > %fileredirec%
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.