0

Wasn't sure how to explain what I want with a title. Basically i have two folders of videos. All with random titles. What i would like to do, is create a windows batch file, that basically puts all filenames into one vlc, but in a set order. For example

Folder A, folder B: -

A
A
B
A
A
B

or

A
A
A
B
A
A
A
B

I found this online when googling "dir /a /b /-p /o:gen >A.vlc" this obviously generates the vlc list from a directory, and i can do that with the other directory, but i then need to combine them with the layout as above.
Or is there a better way to do it?
It has to be a windows batch file (or at least something that can run with windows scheduler)

Many thanks in advance.

  • 2
    I think it's possible with a for /f parsing dir output and in parallel reading from a file with set /p like this batch from [Aacini](https://stackoverflow.com/a/50068272/6811411) but [SO] isn't a script writing service, you should [edit](https://stackoverflow.com/posts/50162618/edit) your question to show your coding effort. –  May 03 '18 at 21:04

1 Answers1

0

Surely there must be some better way to do this. Here is a simplistic PowerShell script to merge the two directories based on a ratio; Acount:Bcount. I want to think there is an easier way.

Put this code in a file with a .ps1 extension. Perhaps mix.ps1. If you are not familiar with how to run PowerShell scripts, search the web. It has been explained a gabillion and a half times.

$Alist = Get-ChildItem -File -Path "A" | ForEach-Object { $_.FullName }
$Blist = Get-ChildItem -File -Path "B" | ForEach-Object { $_.FullName }

$Acount = 2
$Bcount = 1

$Astart = 0
$Bstart = 0
$Total = $Alist.Length + $Blist.Length

$i = 0
while ($i -lt $Total) {
    if ($Astart -lt $Alist.Length) {
        $Alist[$Astart..$($Astart+$Acount-1)]
        $i += $Alist[$Astart..$($Astart+$Acount-1)].Length
        $Astart += $Acount
    }

    if ($Bstart -lt $Blist.Length) {
        $Blist[$Bstart..$($Bstart+$Bcount-1)]
        $i += $Blist[$Bstart..$($Bstart+$Bcount-1)].Length
        $Bstart += $Bcount
    }
}
lit
  • 14,456
  • 10
  • 65
  • 119