Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

create sub-folders with the names of files in a folder then copy the files to the named folder

Posted on 2008-11-04
2
Medium Priority
?
216 Views
Last Modified: 2013-11-10
We have scanned  a 1,000's of files to a folder. Each file now needs to be copied into a folder with the same name as the file without the extension.

I either need software or code to help me do this.
0
Comment
Question by:scsoil
2 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 1000 total points
ID: 22879822
Paste the script below into a text file with a .cmd extension.  Customize the value of the folder variable with the folder containing the files.  Running the script will copy each file into a subfolder with the same name, not including the extension.


@echo off
setlocal
 
set folder=c:\files
 
for /F "tokens=*" %%G in ('dir "%folder%" /A:-D /B') do (
 xcopy "%folder%\%%G" "%folder%\%%~nG\" /C /H /R /Y > NUL
)

Open in new window

0
 

Author Closing Comment

by:scsoil
ID: 31513242
That was great. It worked pefectly. Thank you very much.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

810 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