How to change suffix in a bat-file.

November 15, 2010 at 01:43:45
Specs: Windows XP
I have a file which I want to ftp daily. The problem is that the file will get a new suffix every day. I.e FILE.001 day 1, FILE.002 day 2 and so on...

How do I make a file to ftp the file eith the new suffix everyday?


See More: How to change suffix in a bat-file.

Report •


#1
November 15, 2010 at 04:29:34
Set a var to the newest file name.

===============================

@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/o-d') do (
set v=%%a
goto :done
)
:done
echo.!v!


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
November 15, 2010 at 23:13:06
My ftp-script looks like this. The thing is that I need to check the suffix. I have the number in a separate textfile (suffix.txt), which updates daily.
How do I script that?

{usrname}
{pwd}
lcd D:\Invoice
bin
cd tmp
put FILE.002
rename FILE.002 ..\FILE.002
bye


Report •

#3
November 15, 2010 at 23:19:23
Maybe this:

set /p suf=<suffix.txt
put FILE.%suf%


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions


Ask Question