Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Script/batch file to copy and rename select folders

Posted on 2007-03-26
3
Medium Priority
?
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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 is around source server preparation. No migration is an easy migration, there is a…
Because virtualization becomes more and more common, and, with Microsoft Hyper-V included in Windows Server at no additional costs, and, most server hardware nowadays is more than capable of running a physical Small Business Server (SBS) 2008 or 201…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 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