Entra:     


Forum: Wishes and new features

Topic: Orphaned Stem clean up tool
Since I create my own custom edits and music video edits, it is common that I tweek a song and replace it in my catalog but I found hundreds of Stem files of files that no longer exist.
It would be nice to have an Orphaned Stem file locator and remover. No idea how much space is being taken up by these files.
 

Inviato Fri 19 Jun 26 @ 9:31 pm
Hello DJ Xquiizit,

for the purpose of orphaned sidecar files in a directory and all subdirectories, i am using a MSDOS batch script under Windows. This does work for any sidecar file type, either with a specific file name modification or with a specific file extension. The attached batch file is modified to find orphaned *.vdjstems files, where a corresponding m4a ord mp3 file with the same file name does NOT exist. You can easily modify the batch file to include other file extensions (wav, mp4 ...) as well.

Remark:
I did not include a simple file listing and user dialog before any deletions.
May be you can try this on your own? I do not need this for a fast cleanup.

Best regards from Rudy

Here is the batch code:
• The line with file deletions is now disabled with REM comment.
• Please test the file only with test (sub)directories and test files.
• You have to drag&drop a directory to this batch file in order to work.

echo ===============================================================================
echo Delete orphaned STEM files *.vdjstem in folder and subfolder
echo -------------------------------------------------------------------------------
echo file: vdj_orphaned-stems.bat version: 2026-07-02
echo author: rudolf.eyberg@mtlc.eu
echo ===============================================================================

REM set current drive/directory and source drive/path
(set curdrv=%~d0\) & (set curdir=%~p0) & (set curpat=%~dp0) & (set error=0)
(set srcdrv=%~d1\) & (set srcnam=%~n1) & (set srcext=%~x1)
REM Check if input variable %p1 is file or directory
if exist "%~dpnx1" (set srcdir=%~p1) & (set srcpat=%~dp1) & (set source=%~dp1)
if exist "%~dpn1\*" (set srcdir=%~pn1\) & (set srcpat=%~dpn1\) & (set source=%~dpn1\)
title VDJSTEMS %source%
set srcdir=%srcdir:~1%

REM ****** SET IMPORTANT PARAMETERS ***********************************************
set error=no-error
set sok=off
REM *******************************************************************************

if not exist "%source%" (set error=no-source-exist_%error%) & (goto error)
echo.
echo Source: %srcdrv% + %srcdir%
REM Switch to source directory
cd /d %source%

goto start

:error
echo.   
echo %%source%% = "%source%"
echo %%error%% = "%error%"
goto end

:start
setlocal ENABLEDELAYEDEXPANSION
echo.
echo -------------------------------------------------------------------------------
echo Delete "*.vdjstems" in target, when no source *.mp3, *.m4a ... does exist.
echo -------------------------------------------------------------------------------
echo.

for /r "%source%" %%p in (*.vdjstems) do (
(set drv=%%~di\) & (set dyr=%%~pi) & (set nam=%%~ni) & (set nam=!nam:~0,-4!)
(set ext=%%~xi) & (set fil="%%i") & (set dyr=!dyr:~1!)

REM Check in source
if exist "!drv!!dyr!!nam!.mp3" (set sok=on)
if exist "!drv!!dyr!!nam!.m4a" (set sok=on)
REM Erase orphaned *.vdjstems in source
if not .!sok!.==.on. attrib -r !fil!
if not .!sok!.==.on. echo orphaned file: !drv!!dyr!!nam!.vdjstems
REM if not .!sok!.==.on. erase !fil! /f
set sok=off
)
echo.
pause
endlocal
 

Another option is to use the free, powerful windows tool Everything and to search for *.mp3* or *.m4a* or *wav* ... in all relevant folders. When you sort the search result with file names, you can visually identify all orphaned vdjstems-files with missing "partner" above. And delete manually.
See attached screenshot with missing file "Sean Finn - Lost In Music.mp3".
Everything is available here: http://voidtools.com
 

There is a minor error in my above batch file.
Sorry, I am no longer allowed to edit this recent message in the forum.

You have to remove the file extension (three char) from the audio files
with the additional command: set nam=!nam:~0,-4!

(set drv=%%~di\) & (set dyr=%%~pi) & (set nam=%%~ni) & (set nam=!nam:~0,-4!)
(set ext=%%~xi) & (set fil="%%i") & (set dyr=!dyr:~1!)
 

@DJ-U2HU Mod note: edited in.