Code: Select all
$maxCreate = 100
$dstFolder = "R:\tst_files" # ADAPT THE PATH!
# Create destination folder if necessary
if (-Not (Test-Path $dstFolder.trim())) {
New-Item -Path $dstFolder -ItemType Directory | Out-Null
}
# Create file(s)
$lenPrefix = "$maxCreate".length
for ($i = 1; $i -le $maxCreate; $i++) {
$prefix = "{0:d$lenPrefix}" -f $i
Out-File ("$dstFolder\" + $prefix + ".txt") -Encoding ascii
}
Code: Select all
$files = listpane(, , 1+4, <crlf>);
$select = "";
$i = 1;
foreach($file, $files, <crlf>, "e") {
if ($i % 2 == 0) { $select .= $file . <crlf>; }
$i++;
}
selectitems $select;
002.txt
004.txt
Now do it with the "|"-version of the script:
Code: Select all
$files = listpane(, , 1+4);
$select = "";
$i = 1;
foreach($file, $files, , "e") {
if ($i % 2 == 0) { $select .= $file . "|"; }
$i++;
}
selectitems $select;
XYplorer Beta Club