Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-20
6
Medium Priority
?
5,092 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Expert Comment

by:5g6tdcv4
ID: 36568708
0
 

Author Comment

by:windows7expert
ID: 36568709
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 58

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 36568738
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:pnorms
ID: 36569167
Are you using admin shares?
0
 

Author Closing Comment

by:windows7expert
ID: 36569258
BP, that worked perfectly!
0
 
LVL 58

Expert Comment

by:Bill Prew
ID: 36569282
Great, glad that helped.

~bp
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

604 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