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=TestArchiv e-
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^,Minu te^,Month^ ,Quarter^, Second^,We ekInMonth^ ,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%%Da y%_%Hour%% Minute%%Se cond%
set ArchiveName=%ArchiveBaseNa me%-%TimeS tamp%.zip
set FullFileList=
echo Compressing '%FileList%' in '%SourceFolder%' ...
for %%a in (%FileList%) do (set FullFileList=!FullFileList ! "%SourceFolder%\%%~a")
"%SevenZip%" a -tzip "%TargetFolder%\%ArchiveNa me%" %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\Test Archive--2 0140527_21 2012.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.
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\
set ArchiveBaseName=TestArchiv
set DeleteAge=21
set SevenZip=%ProgramFiles%\7-
echo Getting time ...
for /f "tokens=1-9" %%a in ('wmic Path Win32_LocalTime Get Day^,DayOfWeek^,Hour^,Minu
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%%Da
set ArchiveName=%ArchiveBaseNa
set FullFileList=
echo Compressing '%FileList%' in '%SourceFolder%' ...
for %%a in (%FileList%) do (set FullFileList=!FullFileList
"%SevenZip%" a -tzip "%TargetFolder%\%ArchiveNa
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\Test
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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>
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>
ASKER
thank you!
ASKER
kindly suggest what i may be missing.
temp.png