FG
šŸ’» Software

Creating a folder from first 5 characters of filename in a batch file

Fresh6 days ago
Mar 15, 20269780 views
Confidence Score0%
0%

Problem

Here's what I have: I would like to have the script read the first 5 digits from the file, create a folder with those digits, and include the letter T before it. The result after running should be like this: Currently, I have this, which does the function; I just can't figure out where to put the S…

Error Output

C:\test\12345-test1.txt
C:\test\23456-test2.txt
C:\test\44444-test3.doc

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Creating a folder from first 5 characters of filename in a batch file

Low Risk

This will process files (= no dirs) in the working directory. I also added a check to prevent the script from moving the batch file itself in case it happens to be located in the wd.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment