Page 1 of 1

Move file to folder with same name as file

PostPosted: Fri Oct 15, 2021 12:16 pm
by NewBorn
Need to move many files into a folder with same name as the file minus file extension.

Re: Move file to folder with same name as file

PostPosted: Fri Oct 15, 2021 4:34 pm
by therube
From outside of BRU...


From a command prompt, something like this might work:

test.bat
Code: Select all
for %i in (*.*) do md        "%~ni"
for %i in (*.*) do move "%i" "%~ni"

Above will fail if a filename has no extension.


Set up a test location with some sample data & try it.

Re: Move file to same named folder

PostPosted: Fri Oct 15, 2021 5:26 pm
by Luuk
Also, this link can have some other ways to conduct the same...
viewtopic.php?f=2&t=5621