V
V
Vlad Smirnov2020-07-06 14:53:34
Automation
Vlad Smirnov, 2020-07-06 14:53:34

Move *xlsx files to folder by name?

Good afternoon, there are *xlsx files - which are named as follows UACU5472075korrekt.XLS_v1.xlsx ; UACU5472885korrekt.XLS.xlsx etc. - there are also folders named UACU5472885 (first 11 characters) of the file.
1) We need a script - which would add these files to these folders. Or,,,
2) According to the file name *xlsx created a folder by the first 11 characters (UACU5472885) and moved the file to this folder.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2020-07-06
@res2001

More or less like this:

@echo off
SetLocal EnableDelayedExpansion
for %%a in (*.xlsx) do (
   set "filename=%%~na"
   mkdir !filename:~,11!
   move %%a !filename:~,11!\
)

Didn't check.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question