Computing.Net > Forums > Programming > Create new dir based on dir names

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Create new dir based on dir names

Reply to Message Icon

Name: RushJet1
Date: July 28, 2009 at 13:40:09 Pacific
OS: Windows XP
CPU/Ram: Athlon 64 3400+@2.75
Subcategory: Batch
Comment:

I need to know if there is a way to create new folders based on current folder names, then copy those folders into them. So I'd start out with a list of folders:

123-555558
123-485604
1-4284750
1-334
22-56
22-48573

basically <word/number>-<other stuff>. I'd want to end up with, in the above example, folders named:
123
1
22
and the corresponding folders inside of them. Can anyone help?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 29, 2009 at 04:10:43 Pacific
Reply:

@echo off & setLocal EnableDELAYedExpansion

for /f "tokens=1-2 delims=-" %%a in (myfile) do (
echo md %%a-%%b\%%a\%%b
)


=====================================
If at first you don't succeed, you're about average.

M2


0
Reply to Message Icon

Related Posts

See More


Variables from CSV adding text into specific...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Create new dir based on dir names

Create text file based on user input www.computing.net/answers/programming/create-text-file-based-on-user-input/20212.html

move file based on text in body www.computing.net/answers/programming/move-file-based-on-text-in-body/20117.html

learn basics www.computing.net/answers/programming/learn-basics/17538.html