Solved

Script/batch file to copy and rename select folders

Posted on 2007-03-26
3
381 Views
Last Modified: 2013-12-04
Dear experts!
I need a script/batch file for copying folders automatically from Windows Server (Small Business Edition) to a connected hard drive.

1) We have a directory on our server called PROJECTS. It contains subdirectories for each project we work on. Each subdirectory’s name begins with the project number (almost always four digits: 1001, 1002, 1003, etc.). It contains a short description after the project number, but always begins with the four (eventually five, I guess)-digit project number.
2) We want to write a script that COPIES project subdirectories from the PROJECT folder to a separate hard disk. The code would do the following:
- scan through the PROJECT folder’s subdirectories, looking for any project whose FIRST CHARACTER is ALPHA (not numeric).
- for that directory, it would check the other hard disk to see whether a similarly named folder already exists.
- if it does NOT exist, it would COPY the entire folder and then RENAME the source folder (either insert another character at the beginning or end of the folder name – we’re flexible on this naming convention).
- if it DOES exist, it would simply skip the folder. [nice to have: store this information in a text file generated at the end, ideally listing the folder size on the original and on the remote hard drive – strictly “nice to have”]

Thanks for your assistance on this!!

0
Comment
Question by:terpsichore
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18794932
I would encourage you to use a solution like robocopy for this...it's what it was made for.
It can be setup to copy only changed data, if your source data is altered.

http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en is the link to download it from.

You can also save a job specification like you want it, so you'd simply call the program each time you needed to update.

If that sounds like a feasible solution for you, it's very simple to write a batch file to accomplish it....
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found here: http://www.experts-exchang…
I’m often asked about newer and larger USB drives connected to SBS2008 and 2011 failing Windows Server Backup vs the older USB drives not failing. As disk space continues to grow and drive technology change SBS2008 and some SBS2011 end up with the f…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

21 Experts available now in Live!

Get 1:1 Help Now