I wrote a batch file using drag and drop to move multiple files in a folder to another directory with a new folder with the same name as the folder before.
Example if I have a folder that is name Stuff and within this folder I have three files a.png, b.txt, and c.jpg.
Let's say the first folder Stuff that holds the files that I want to move are in a directory like ...\flower\things\Stuff.
Then I want to make a new folder at C:\ with the name Stuff and then move the files within the first folder Stuff to the new folder Stuff at C:\
Example C:\Stuff\a.png, b.txt, c.jpg
I want to make it universal so if the first folder had a different name then Stuff, it will use the name of the folder that holds the files that I want to move.
What I have below works, but I ran to many problems before getting this to work and do not have much knowledge in coding. I was wondering if the batch file will run to any problems or if there is a simpler or cleaner way of doing this.
@ECHO OFF
ECHO "%~1"
FOR %%I IN (.) DO SET CurrentD=%%~nI%%~xI
MKDIR "C:\%CurrentD%"
:loop
MOVE "%~1" "C:\%CurrentD%"
shift
if not ["%~1"]==[""] goto loop