Solved

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

Posted on 2013-10-23
2
1,154 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 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 39594640
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
ID: 39594752
Awesome.....this was what I was looking for.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Concerto Cloud Services, a provider of fully managed private, public and hybrid cloud solutions, announced today it was named to the 20 Coolest Cloud Infrastructure Vendors Of The 2017 Cloud  (http://www.concertocloud.com/about/in-the-news/2017/02/0…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

813 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

16 Experts available now in Live!

Get 1:1 Help Now