?
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
?
4,847 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 56

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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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 56

Expert Comment

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

~bp
0

Featured Post

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

777 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