Answer the question
In order to leave comments, you need to log in
How to move files in folders by even/odd parity of name?
There are files, many files, the names are numbers, like "1.txt" , "2.txt", "3.txt" etc. It is necessary to move files with even names to folder "a", and to folder "b" with odd ones. I wrote something like this, but I simply can’t write the file name to a variable.
@echo off
setlocal ENABLEDELAYEDEXPANSION
for %%i in (*.txt) do (
set filename=%%i
set filename=!filename:~2!
set filename=!filename:~0,1!
move filename.txt a
)
Answer the question
In order to leave comments, you need to log in
Maybe something like this:
for /l %%d in (0 2 8) do move *%%d.txt a\
for /l %%d in (1 2 9) do move *%%d.txt b\
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question