Solved

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

Posted on 2011-09-20
6
4,202 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
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 53

Accepted Solution

by:
Bill Prew earned 500 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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 53

Expert Comment

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

~bp
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Selecting Operating System at boot screen 4 63
in what format to convert 4 k without losing quality? 12 29
accidental deletion - ad recycle bin 3 21
facebook change 4 37
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
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). …
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

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