Name: YACOLT Date: February 2, 2008 at 21:50:01 Pacific Subject: Make new folder from file name OS: xp pro CPU/Ram: not sure Model/Manufacturer: not sure
Comment:
I would like to take every file name in a folder - make a new sub-folder inside that folder naming it from each file name - and then put the file in the folder that has been named after the file.
I spent over an hour on this site looking through past posts to see if I could find something I could modify - but I’m not much of a programmer. I did see stuff that was similar but I’m not even sure if I would use a batch file or DOS commands to do what I need to do.
I’m using XP professional and I saw some code that used XP to do stuff.
Could someone point me to the best way to do this?
It's not quite as easy as it seems. Do you want the directory name to have the same extension as the file name? If so, you can't create a directory of the same name as an existing file name, so you'll have to create a directory with a temporary name first, then move the file into the temporary directory and finally rename the directory to the name of the file.
Even if you want to name the directory without an extension, you will still have to use a temporary name because some files may have no extension and you won't be able to create directories for them.
Now there's another problem: what name do you use as a temporary name that you can guarantee it will never clash with an existing file name?
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE