Link to home
Start Free TrialLog in
Avatar of 25112
25112

asked on

"WARNING: The system cannot find the file specified." command line error..

Hi

I have stored the below in
c:\run.bat

~~~~~~~~~~~~
@echo off
setlocal enabledelayedexpansion
set SourceFolder=C:\Dell\Temp
set FileList="test1.txt" "test2.txt" "test3.txt"
set TargetFolder=C:\Dell\Temp\TestTemp
set ArchiveBaseName=TestArchive-
set DeleteAge=21
set SevenZip=%ProgramFiles%\7-Zip\7z.exe
echo Getting time ...
for /f "tokens=1-9" %%a in ('wmic Path Win32_LocalTime Get Day^,DayOfWeek^,Hour^,Minute^,Month^,Quarter^,Second^,WeekInMonth^,Year ^| find /v ""') do (
  set /a Line += 1
  if "!Line!"=="1" (set VarA=%%a&set VarB=%%b&set VarC=%%c&set VarD=%%d&set VarE=%%e&set VarF=%%f&set VarG=%%g&set VarH=%%h&set VarI=%%i)
  if "!Line!"=="2" (set !VarA!=%%a&set !VarB!=%%b&set !VarC!=%%c&set !VarD!=%%d&set !VarE!=%%e&set !VarF!=%%f&set !VarG!=%%g&set !VarH!=%%h&set !VarI!=%%i)
)
for %%a in (Month Day Hour Minute Second) do (if !%%a! LSS 10 set %%a=0!%%a!)
set TimeStamp=%Year%%Month%%Day%_%Hour%%Minute%%Second%
set ArchiveName=%ArchiveBaseName%-%TimeStamp%.zip
set FullFileList=
echo Compressing '%FileList%' in '%SourceFolder%' ...
for %%a in (%FileList%) do (set FullFileList=!FullFileList! "%SourceFolder%\%%~a")
"%SevenZip%" a -tzip "%TargetFolder%\%ArchiveName%" %FullFileList%
echo Removing files older than %DeleteAge% days ...
for /f "tokens=1* delims=:       " %%a in ('robocopy.exe "%TargetFolder%" "C:\Dummy" "*.*" /l /minage:%DeleteAge% /ndl /njh /njs /ns /nc /np') do (
      echo '%%a:%%b' ...
      ECHO del "%%a:%%b"
)
echo Done.

~~~~~~~~~~~~~~                  

then i can getting the below error

C:\>run.bat
Getting time ...
Compressing '"test1.txt" "test2.txt" "test3.txt"' in 'C:\Dell\Temp' ...

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
Scanning


C:\Dell\Temp\test1.txt:  WARNING: The system cannot find the file specified.

C:\Dell\Temp\test2.txt:  WARNING: The system cannot find the file specified.

C:\Dell\Temp\test3.txt:  WARNING: The system cannot find the file specified.



Creating archive C:\Dell\Temp\TestTemp\TestArchive--20140527_212012.zip



WARNINGS for files:

C:\Dell\Temp\test1.txt : The system cannot find the file specified.

C:\Dell\Temp\test2.txt : The system cannot find the file specified.

C:\Dell\Temp\test3.txt : The system cannot find the file specified.

----------------
WARNING: Cannot find 3 files
Removing files older than 21 days ...
Done.

C:\>



i see it creates the archives, but the files are still there. can you suggest what i need to edit to customize this in my situation.

thanks much.
SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 25112
25112

ASKER

hi, thanks for checking it. but i do verify that these 3 files are in the folder..

kindly suggest what i may be missing.
temp.png
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 25112

ASKER

you are so true!

C:\Dell\Temp>dir C:\Dell\Temp\test*.*
 Volume in drive C has no label.
 Volume Serial Number is E82D-2B62

 Directory of C:\Dell\Temp

05/27/2014  08:39 PM                 0 test1.txt.txt
05/27/2014  08:39 PM                 0 test2.txt.txt
05/27/2014  08:39 PM                 0 test3.txt.txt
05/27/2014  09:20 PM    <DIR>          TestTemp
               3 File(s)              0 bytes
               1 Dir(s)  76,638,838,784 bytes free

C:\Dell\Temp>
Avatar of 25112

ASKER

thank you!