Solved

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

Posted on 2013-12-20
2
532 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 150 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 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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes

691 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