- Batch create folders and move files?
- Posted by gqcovermodel@gmail.com on November 23rd, 2005
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
- Posted by Ron Sommer on November 23rd, 2005
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.
--
Ron Sommer
<gqcovermodel@gmail.com> wrote in message
news:1132710822.779226.263770@f14g2000cwb.googlegr oups.com...
>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
>
- Posted by Pegasus \(MVP\) on November 23rd, 2005
<gqcovermodel@gmail.com> wrote in message
news:1132710822.779226.263770@f14g2000cwb.googlegr oups.com...
> 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".
- Posted by Larry(LJL269) on November 23rd, 2005
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, gqcovermodel@gmail.com
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.