3

I was able to do this in Linux, but Windows batch script is a lot different, hope someone can help me. I have a folder with a couple 100 files. I want a batch script that creates a folder for each of these files with the same name, but without the extension (eg: sheet1.xls will create a folder named sheet1).

After that each file should to moved to its corresponding folder (eg: sheet1.xls -> create folder sheet1 -> move the xls file to sheet1 folder).

Can anyone help me out with this?

1 Answer 1

3
for %%a in (C:\folder\*.*) do (
md "%%~pna"
move "%%a" "%%~pna"
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.