windows bash script to find a folder in a server -


i write script find specific folder named 'a' in several windows servers copy files folder.

problem there many different share drives in servers , folder in of them. end big loop , numbers of if statement under it. wondering if there simple way of doing it. appreciated.

js

here bit of script include 2 of share drives :

@echo off cd /d %~dp0 setlocal enabledelayedexpansion   /f %%a in (serverlist.txt) ( if exist \\%%a\s$\a (  robocopy  sourcefolder \\%%a\s$\a /e ) else ( if exist \\%%a\e$\a ( robocopy  sourcefolder \\%%a\e$\a /e ) else ( echo %%a has incorrect folder >> errorlog.txt )  )  endlocal pause 

i suppose batch (not bash) run multiple time, instread of having txt list of servers better use list of shares exist, adapt script produce such list.

if one-time convenience script , wonder if better, skip checks , robocopy, fail if targetfolder doesn't exist.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -