Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
Im trying to do nested for below :-
1. loop out thru sharepoint
2. for every sharepoint, copy only recent files, for testing i just echo the most recent filename.here what i came out and didnot work as i expected for 2 loop..
@echo off
For /F "tokens=1,2,3,4" %%a in (Tools.txt) Do (
echo %%a,%%b,%%c,%%d >> extract.txt
for /f "delims=" %%m in ('dir /od /a-d /b %%a\*.txt') do set recent=%%m
echo %%m >> recent.txt
)

Ok, i managed to get this work after separating it in function. dunno why, but i have 2nd requirement. I need to get 2nd most recent file, if the recent file return file less than 500kb..
Tool.txt contains below
DS15 \\PGO-desk1.ar.com\LogFile\DS\DS15\20090901 LC14 ds26FOR /F "TOKENS=1,2,3,4 DELIMS= " %%a IN (Tools.txt) DO (
net use x: %%b
if exist x: (
call :recent %%b
):recent
for /f "delims=" %%m in ('dir /od /a-d /b %~1\*.txt') do set recent=%%m
if not "%recent%" =="" (
copy "c:\keke\head.txt" + "%~1\%recent%" "c:\keke\new\%recent%"
)
if "%recent%" =="" (echo "No Log available" >> c:\keke\new\bad.txt )
pause
goto :eof

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |