1.

Solve : Need a batch - it not an easy one this on?

Answer»

A batch file that will
1. take the two character or digits before the first FULL STOP (.)
2. create a directory from these digits.
3. test to see if the directory is already created

Examples filenames below:
AE567321.PDF Move to FOLDER (21)
AD456958.pdf Move to Folder (58)
AF56JK.pdf Move to Folder (JK)
AE238832.001.pdf Move to Folder (32)
AE456958.003.pdf Move to Folder (58)
AF56H7.002.pdf Move to Folder (H7)

4. moving the file to the named Directory.


Hope you can hel[
Code: [Select]
@echo off
setlocal enabledelayedexpansion
for /f "delims==" %%A in ('dir /b *.pdf') do (
set namepart=%%~nA
set lastchrs=!namepart:~-2,2!
if not exist !lastchrs! md !lastchrs!
move "%%A" !lastchrs!
)



Discussion

No Comment Found