Solved

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

Posted on 2013-12-20
2
504 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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
for loop with Set 4 45
Excel object stays open 19 64
wordmultiple challenge 12 89
Base1 Encode/Decode 3 0
A short article about problems I had with the new location API and permissions in Marshmallow
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.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

772 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

12 Experts available now in Live!

Get 1:1 Help Now