Solved

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

Posted on 2013-12-20
2
515 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
2 Comments
 
LVL 13

Accepted Solution

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

Assisted Solution

by:Lionel MM
Lionel MM earned 50 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

770 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