?
Solved

batch file to: scan a folder with subfolders, create equivalent folder with subfolders without files

Posted on 2013-12-20
2
Medium Priority
?
537 Views
Last Modified: 2013-12-22
Hi all,
i have this structure:
2013\customer1\dataA
2013\customer1\dataB
2013\customer2\dataA
2013\customer2\dataB
2013\customer2\dataC
and so on...All subfolders are full of files.

I need a batch file that:
1) SCAN folder from 2013 until last subfolders
2) CREATE a folder named 2014 with the same structure
2014\customer1\dataA
2014\customer1\dataB
2014\customer2\dataA
2014\customer2\dataB
2014\customer2\dataC
but without files!

Other info:
-path of folder 2013 should be a variable
-i need a confirm when succeed in

Sorry for my english, please ask me for details!
Thanks
0
Comment
Question by:nautilus01
[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
2 Comments
 
LVL 13

Accepted Solution

by:
akb earned 600 total points
ID: 39733177
You can use xcopy /t /e
Refer to http://www.computerhope.com/xcopyhlp.htm
0
 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 200 total points
ID: 39733503
the xcopy command with the switches /t and /e is what is needed
xcopy c:\2013 c:\20014 /t /e
This will copy all folders under the directory c:\2013 to a folder called c:\2014 including any empty folder (the /e switch). The T switch (/t) Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.

so a bacth file can be


or
Set source=c:\2013
Set target=c:\2014
xcopy %source%\ %target%\ /t/e
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Progress
Starting up a Project

765 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