Solved

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

Posted on 2013-12-20
2
509 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:lionelmm
lionelmm 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 123
Trying to run powershell  in a batch file. How do I do this? 8 63
creating threads in delphi 1 80
iframe detection of parent window scale 20 59
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

943 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

4 Experts available now in Live!

Get 1:1 Help Now