Page 1 of 1

[Script] Copy every Nth face to subfolder - Lightning fast facesets

Posted: Fri Jul 26, 2019 4:57 am
by Surrogator

The following Windows batch script will create a subdirectory named subset in the working directory where it's called, and then copy every Nth file from the working directory into the subdirectory.

This is useful if you want to create a faceset from an extraction with a low Extract Every N setting (usually EEN=1 if you're using that video for conversion later). Instead of re-extracting those faces with FaceSwap at a higher EEN, you can use the following (Windows) script to copy 1 every N files into a subdirectory.

In the example below, the script lives here:

Code: Select all

C:\swaps\extractions\every.bat

When you call the script, you must provide a number for N. For example:

Code: Select all

.\every 10
every_bat.png
every_bat.png (123.08 KiB) Viewed 47523 times

Code: Select all

@ECHO off

SETLOCAL EnableDelayedExpansion
SET /A every = %1
SET /A index = 0
SET /A files = 0
SET /A count = 0

MKDIR subset

ECHO Making a copy every %every% files...

FOR %%G IN (*) DO (
    SET /A files += 1
    SET /A index += 1
    IF !index! EQU %every% (
        @COPY "%%G" .\subset 1>NUL
        SET /A count += 1
        SET /A index = 0
    )
)

ECHO Copied %count%/%files% files.

ENDLOCAL

Re: [Script] Copy every Nth face to subfolder - Lightning fast facesets

Posted: Sat Jan 18, 2020 5:38 pm
by Now

thanks, will give it go next time, had problems doing this is the past.. want to keep the number of frames to a min... currently on 10 k either side.