Solved

Need a batch script to check if a remote folder exists from a list of machines

Posted on 2011-09-20
6
3,950 Views
Last Modified: 2012-05-12
Hi,

I need a batch script that will check to see if a remote folder exists based on a list of machines in a text file.  I will be running this script from my desktop and need to verify the existence of a folder on each of our servers.

For example, I'd like to verify that c:\windows\system32\test folder exists from a list of machines in machines.txt

Thanks!
0
Comment
Question by:windows7expert
6 Comments
 
LVL 13

Expert Comment

by:5g6tdcv4
Comment Utility
0
 

Author Comment

by:windows7expert
Comment Utility
I would also like it to output to another text file detailing the results of whether or not the folder exists on that specific machine.
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
Comment Utility
How about something like this.  Save as a BAT file and run from same folder as machines.txt.

@echo off
if exist "exists.txt" del "exists.txt"
for /F %%A in (machines.txt) do (
  if exist "\\%%A\C$\windows\system\test\" (
    echo %%A : FOUND >>exists.txt
  ) else (
    echo %%A : MISSING >>exists.txt
  )
)

Open in new window

~bp
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:pnorms
Comment Utility
Are you using admin shares?
0
 

Author Closing Comment

by:windows7expert
Comment Utility
BP, that worked perfectly!
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
Great, glad that helped.

~bp
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now