I have found an old post
Mechanix2Go March 20, 2008 at 14:09:58 PacificThis should do the confog.sys
::== my2.bat
:: copy latest c:\windows\config.xxx to \config.bat@echo off
c:
cd \windowsdir /b/o-d config.* > list
> some.d echo n list
>> some.d echo L 105
>> some.d echo e 100 'copy '
>> some.d echo e 10f ' \config.sys'
>> some.d echo rcx
>> some.d echo 1b
>> some.d echo N newcfg.bat
>> some.d echo w
>> some.d echo qdebug < some.d
newcfg.bat
=====================================
If at first you don't succeed, you're about average.M2
I am trying to use this same function to copy the latest image from some directories into a single location.
I would also like to rename this file.So far I can create a list in order but I dont know how to grab the top line.
So far
@echo off
dir s/b/o-d *.jpg > listAny help would be appreciated.
:: ==========================================
::
:: latest.bat Wed 02-03-2011 18:54:36.18
@echo off & setLocal enableDELAYedeXpansionfor /f "tokens=* delims= " %%a in ('dir /b/o-d *.jpg') do (
copy %%a d:\mypix\current.jpg
goto :eof
)
=====================================
Life is too important to be taken seriously.M2
Thanks Mechanix2GO This nearly does exactly what I need however if I have this batch file in a root folder with folders of image files is it possible to find the latest file from the subdirectories?
If I have this in the same folder as the images it works perfectly.
Many Thanks
MM
Hi M2 I have managed to get it closer using
@echo off & setLocal enableDELAYedeXpansion
for /f "tokens=* delims= " %%a in ('dir /s/b/o-d *.jpg') do (
copy %%a d:\mypix\current.jpg
goto :eof
)However it only found the latest file in the 1st folder and I have a few folders.
Many Thanks
MM
Yep Run this and post output:
:: ==========================================
::
:: TD.bat Fri 04-03-2011 13:49:20.26
@echo off & setLocal enableDELAYedeXpansionfor /f "tokens=* delims= " %%a in ('dir/b') do (
echo.%%~Ta %%~a
)
=====================================
Life is too important to be taken seriously.M2
Hi Mechanix [IMG]http://i53.tinypic.com/dvo5kp.jpg[/IMG]
http://tinypic.com/r/dvo5kp/7I had to set a pause in to see what it was doing. It just listed the folders and files in the directory.
In each directory I receive files each day and a new directory is automatically created from the camera. My aim is to create a webpage using the same name for the latest image.Many Thanks
MM
PS Sorry for the delay I have been very busy. Also I know you are busy but how or where can I learn what all these commands do?
So does it boil down to get the newest file from the newest folder?
=====================================
Life is too important to be taken seriously.M2
Hi M2 Yes that is what I need the newest file from the newest folder copied to a specific folder and renamed latest.jpg
Post the output of this. ==================================
@echo off & setLocal enableDELAYedeXpansionfor /f "tokens=* delims= " %%a in ('dir/b/s/ad') do (
echo.%%~Ta %%a
)
=====================================
Life is too important to be taken seriously.M2
Hi Mechanix Output =
[IMG]http://i54.tinypic.com/15q2kxv.jpg[/IMG]
http://tinypic.com/r/15q2kxv/7Many Thanks
MM
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |