Solved

Robocopy "Home Directory" script.  Need help getting the first letter of a user name.

Posted on 2013-10-23
2
1,131 Views
Last Modified: 2013-10-23
I need a simple script (Powershell, batch, vb) that will robocopy the first letter of the folder to the destination file server.

For example.  I'd like to take all the user's folders from the source directory with first initial "a" and copy it over to a specified path on another server.

Please help!
0
Comment
Question by:tools2teach
2 Comments
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
Put a loop around robocopy; the following script is in test mode and will only display the robocopy commands it would normally run. Remove the uppercase ECHO in line 8 to run it for real (and configure the robocopy options you want in the Filter variable)
@echo off
setlocal enabledelayedexpansion
set SourceFolder=C:\Temp
set TargetFolder=D:\Temp
set Filter=A*
set RCOptions=/e /np /r:0 /w:0
for /d %%a in ("%SourceFolder%\%Filter%") do (
	ECHO robocopy.exe "%%a" "%TargetFolder%\%%~nxa" %RCOptions%
)

Open in new window

0
 

Author Closing Comment

by:tools2teach
Comment Utility
Awesome.....this was what I was looking for.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

772 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