|
Answer» Any help on this issue would be greatly appreciated. I have been running 100s of tests on a PRODUCT and the results end up in one folder.
The results are stored with the FILE name Test_Report["Part NUMBER"]["Time of test"]["Date of test"].html
I want to make a batch file that will organize the reports by part number into folders labeled with the part number and date. The part numbers range from 6 numbers to a combination of letters, symbols and numbers up to 15 characters long.
If you can help that would be awesome.is there any characters Part Number,Time of test, and Date of test
ex Part Number-Time of test-Date of testJust those brackets
An example would be:
Test_Report[53010N0-10SD-00][6 15 11 AM][7 1 2010].htmlWill there ever be report files which have the same part number but different dates? Yes that is possible, so the batch file will have to look at both the date and part number to SORT it properly. I hadn't thought of that, thanks for bringing it to my attentionSo if these files existed
Test_Report[53010N0-10SD-00][6 15 11 AM][7 1 2010].html
Test_Report[53010N0-10SD-00][6 15 11 AM][6 30 2010].html
You would want them in 2 separate folders, called
53010N0-10SD-00 7 1 2010
and
53010N0-10SD-00 6 30 2010
is that right?
Any padding ( e.g. m d yyyy to mm dd yyyy) or desires about white space (e.g. convert to dashes?)
Yes that is exactly what I want. The same formatting of the date is fine. Maybe the date can be inside brackets to not get confused with the part number
Code: [Select]echo off setlocal enabledelayedexpansion for /f "delims=" %%A in ('dir /b Test_Report[*.html') do ( set filename=%%A for /f "tokens=1-4 delims=[]" %%B in ("!filename!") do ( set FolderName=%%C (%%E^) if not exist "!FolderName!" md "!FolderName!" move "!filename!" "!foldername!" ) ) echo All files processed pause
Thank you so much! It WORKED like a charm. You just saved me from manually sorting through 500+ files
|