Menu

I'm having problems using the @ operator to use a filelist as source using a batch script

Esteban
2019-01-02
2019-01-17
  • Esteban

    Esteban - 2019-01-02

    Hello, I'm having trouble using 7-Zip (full version 18-05 x64, not command line stand-alone) to find the source files using the @ character to point to a text file that has a list of file names. I've debuged the whole thing and using direct file name for one of the list and it works just fine (just the name and full path too) . But when using a list of files inside a file, I get this:

    Scanning the drive:
    
    WARNING: The system cannot find the file specified.
    @test2.bat.2019-01-02.tmp
    

    Being "test2.bat.2019-01-02.tmp" the name of the temporary file created in the batch script, detailed below.

    @echo off
        setlocal enableextensions disabledelayedexpansion
        pushd "C:\Development\VWDump" || goto :eof
    
        set "today=" & for /f "tokens=1-3 delims=/ " %%a in ('
            robocopy "|" . /njh
        ') do if not defined today set "today=%%a-%%b-%%c"
    
        set "listFile=%~nx0.%today%.tmp"
        >"%listFile%" forfiles /D 0 /M 20*
    
        if not errorlevel 1 (
            "C:\Program Files\7-Zip\7Z.exe" a -tzip -mx5 -scsDOS -y -- "C:\Development\VWBackUp\%today%.zip" @%listFile% 
        )
    

    The source files are plain text files located in "C:\Development\VWDump", with no extention and named with date and incremental number. The file with the list gets created in the same directory and loaded like this (with and empty line at the start):

    "201901020001"
    "201901020002"
    "201901020003"

    I also tried using @C:\Development\VWDump\%listFile%
    and @"C:\Development\VWDump\%listFile%"
    and -i@C:\Development\VWDump\%listFile%
    and -i@"C:\Development\VWDump\%listFile%"
    and many other variants including using full paths for the list of files, with and without quotes, using a fixed name instead of a vriable with %% characters, all of them with no success, but I think that the problem relies on finding the file, not the list itself. I also copied the file to the target directory, to 7-Zip directory and to System32 directory Perhaps I missed another variant or perhaps the @ operator only works on the command line version of 7-Zip, I've run out of options to consider here, can anyone lend me a hand please? Thanks!

     

    Last edit: Esteban 2019-01-02
    • mdadm

      mdadm - 2019-01-17

      There was a change between 7z versions:
      create archive named '-test.7z' with a file list named 'list.txt'
      7z a -- -test.7z @list.txt (7zip 16.02)
      7z a -i@list.txt -- -test.7z (7zip 18.01+)

       
  • Esteban

    Esteban - 2019-01-02

    I think I created this topic on the wrong forum, can an admin move it to "Help" please? Thanks

     

Log in to post a comment.