Answer the question
In order to leave comments, you need to log in
How to automatically create folders by file name and sort files there?
There is a folder with many files, with different names,
how to make folders automatically created in accordance with the first 10 characters of the file and all these files are thrown into the appropriate folder
Answer the question
In order to leave comments, you need to log in
@echo off
rem https://stackoverflow.com/questions/8648178/getting-substring-of-a-token-in-for-loop
setlocal EnableDelayedExpansion
for %%f in ("*.xls") do (
set T1=%%f
set T=!T1:~0,10!
if not exist !T! md !T!
move %%f !T!
)
iterate over files:
for %%f in (directory\path\*.txt) do (
echo "fullname: %%f"
)
mkdir
move
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question