Symbolic links and 7zip
listed in answer
ANSWER:
DIR /S /B follows symlinks, so can do following (this is batch file, paste its contents to OEM (non-unicode) encoded file, say, archivewithsymlinks.cmd).
Note that there’s trick in last line to pass 7z exit error code out of script (without using intermediate variables).
@ECHO OFF
SETLOCAL
REM Note that 7z.exe must be in %PATH% or current directory, or just modify penultimate line.
IF NOT "%~1"=="" GOTO :TryAnotherListFileName
ECHO Usage:
ECHO %0 archivename sourcefiles...
ECHO where:
ECHO archivename filename of archive file, where sourcefiles will be added
ECHO sourcefiles list of files to be added
ECHO.
ECHO Also, %%parm7z%% variable can be defined and will be passed to 7-Zip before archivename
EXIT /B
:TryAnotherListFileName
SET filelist=%TEMP%archiving-%RANDOM%.list
IF EXIST "%filelist%" (
ECHO Filename "%filelist%" already used for something. If that happens regularly, maybe it's time to change something in the batch file "%~f0".
GOTO :TryAnotherListFileName
)
REM remember first argument before SHIFTing
SET ArchiveName=%1
:MoreSourcePaths
DIR /S /B %2 >> "%filelist%"
SHIFT
IF NOT "%~2"=="" GOTO :MoreSourcePaths
7z a %parm7z% -i"%filelist%" -- %ArchiveName%
DEL "%filelist%" & EXIT /B %ERRORLEVEL%

New Comments