I have files the following files in my path
ENG0100100VOL-815299004001
ENG0100100VOL-815299004002
ENG0100100VOL-815299004003
ENG0100100VOL-815299004004
ENG0100100VOL-815300004001
ENG0100100VOL-815300004002
ENG0100100VOL-815300004003
ENG0100100VOL-815300004004
I want to
- create unique folder(s) with the prefix "VOL-" followed by 6 digits identifier and move the respective files of the package to that folder (VOL-81529 and VOL-81530). Ideally its 4 files per folder. NOTE: These values may change overtime and the file numbers are not fixed.
Folder VOL-81529 should contain files
ENG0100100VOL-815299004001
ENG0100100VOL-815299004002
ENG0100100VOL-815299004003
ENG0100100VOL-815299004004
Folder VOL-81530 should contain files
ENG0100100VOL-815300004001
ENG0100100VOL-815300004002
ENG0100100VOL-815300004003
ENG0100100VOL-815300004004
- Traverse through the folders and unzip the file with only suffix 002 and 004 (last three digits) of the 12 digits. And remove all the package files from the folder after unzipping
Folder VOL-81529
ENG0100100VOL-815299004002
ENG0100100VOL-815299004004
Folder VOL-81530
ENG0100100VOL-815300004002
ENG0100100VOL-815300004004
I have little knowledge in coding, I have written this and its requires some additional inputs
$files = Get-ChildItem "\My Documents\Path\files" | ForEach-Object{$_.Tostring().substring(14,5)}
$max =$files.count
for($i=0,$i -lt $max, $i++){if ($files[$i] -eq $files[$i+1]) { $value = $files[$i] } else { $value = $files[$i+1]}}