Batch create folders and move files?

  • Thread starter Thread starter gqcovermodel
  • Start date Start date
G

gqcovermodel

I have a folder that is full of word, excel, and power point files. I
would like to move each file into a folder with the same name as the
file. Is there a simple way that I can do this without having to
manually create a new folder, rename it, and move the file in?

Note that there are already some folders in within the parent folder
that are already contain their respective document. I would like to
leave these folders unaltered.

Any help is grately appriciated.

J
 
What reason do you have to want a folder that will only hold one file?
Unless you create a shortcut, you will have to open the folder to view the
file.
 
I have a folder that is full of word, excel, and power point files. I
would like to move each file into a folder with the same name as the
file. Is there a simple way that I can do this without having to
manually create a new folder, rename it, and move the file in?

Note that there are already some folders in within the parent folder
that are already contain their respective document. I would like to
leave these folders unaltered.

Any help is grately appriciated.

J

You could run this batch file:

@echo off
dir /a-d /b > c:\temp.txt
for /f "tokens=*" %%* in (c:\temp.txt) do call :Sub %%*
del c:\temp.txt
goto :eof

:Sub
for %%I in (%*) do set name=%%~nI
if not exist "%name%" echo md "%name%"
echo move "%*" "%name%"

Please note:
- You must remove the "echo" commands in the last
two lines to activate the batch file.
- The batch file is unable to deal with file names that
have embedded brackets, e.g. "My File (1).doc".
 
Wrie a macro with AutoIt $0:
http://www.autoitscript.com/autoit3/index.php but u
gottaa invest time 2 learn + debug. I've saved months
of work.

HTH-Larry

On 22 Nov 2005 17:53:42 -0800, (e-mail address removed)
wrote:

|I have a folder that is full of word, excel, and power point files. I
|would like to move each file into a folder with the same name as the
|file. Is there a simple way that I can do this without having to
|manually create a new folder, rename it, and move the file in?
|
|Note that there are already some folders in within the parent folder
|that are already contain their respective document. I would like to
|leave these folders unaltered.
|
|Any help is grately appriciated.
|
|J

Any advise is my attempt to contribute more than I have received but I can only assure you that it works on my PC. GOOD LUCK.
 
Back
Top