Can someone provide batch code?

February 21, 2009 at 13:36:34
Specs: Windows XP
I have a directory holding an MP3 file for each day. (ie: Feb09.mp3, Feb25.mp3 etc.)
I need a batch file that will determine the current date....
Grab the file for the current date....
and FTP it to a location OVERWRITING (without confirmation) what is there.
The destination file name will ALWAYS BE rw.mp3
I'll run this via the task scheduler each night.
Can someone show me the Batch code that will do that?

See More: Can someone provide batch code?

Report •


#1
February 21, 2009 at 15:57:31
@echo off & setLocal EnableDelayedExpansion

call :sub1

copy %MMM%%dat%.mp3 rw.mp3

> #.ftp echo o mysite
>> #.ftp echo username
>> #.ftp echo password
>> #.ftp echo bin
>> #.ftp echo put rw.mp3
>> #.ftp echo bye

ftp -s:#.ftp

goto :eof

:sub1

@echo off > d.d

>> d.d echo E 0100 B4 2A CD 21 B4 4C CD 21
>> d.d echo N DAY.COM
>> d.d echo RCX
>> d.d echo 8
>> d.d echo W
>> d.d echo E 0100 B4 2A CD 21 88 F0 B4 4C CD 21
>> d.d echo N MONTH.COM
>> d.d echo RCX
>> d.d echo A
>> d.d echo W
>> d.d echo E 0100 B4 2A CD 21 89 C8 B4 4C CD 21
>> d.d echo N YEAR.COM
>> d.d echo RCX
>> d.d echo A
>> d.d echo W
>> d.d echo E 0100 B4 2A CD 21 88 D0 B4 4C CD 21
>> d.d echo N DAT.COM
>> d.d echo RCX
>> d.d echo A
>> d.d echo W
>> d.d echo Q

debug < d.d > nul
del d.d

dat
for %%a in (1 2 3 4 5 6 7 8 9 ) do if errorlevel %%a set dat=0%%a
for %%a in ( 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) do if errorlevel %%a set dat=%%a
echo Date %dat%

day
if errorlevel 0 set day=Sunday
if errorlevel 1 set day=Monday
if errorlevel 2 set day=Tuesday
if errorlevel 3 set day=Wednesday
if errorlevel 4 set day=Thursday
if errorlevel 5 set day=Friday
if errorlevel 6 set day=Saturday
echo Day %day%

month
for %%a in (1 2 3 4 5 6 7 8 9 ) do if errorlevel %%a set month=0%%a
for %%a in ( 10 11 12) do if errorlevel %%a set month=%%a

if %month%==01 set MMM=Jan
if %month%==02 set MMM=Feb
if %month%==03 set MMM=Mar
if %month%==04 set MMM=Apr
if %month%==05 set MMM=May
if %month%==06 set MMM=JUn
if %month%==07 set MMM=Jul
if %month%==08 set MMM=Aug
if %month%==09 set MMM=Sep
if %month%==10 set MMM=Oct
if %month%==11 set MMM=Nov
if %month%==12 set MMM=Dec

echo MMM %MMM%
echo Month %month%

year
if errorlevel 215 set Year=2007
if errorlevel 216 set Year=2008
if errorlevel 217 set Year=2009
if errorlevel 218 set Year=2010
echo Year %Year%

del day.com
del month.com
del year.com
del dat.com

goto :eof


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
February 21, 2009 at 18:14:29
wow..
thanks..
I'll try this tomorrow

Report •

#3
February 22, 2009 at 04:59:41
all is great.
Thanks so much for providing this for me.

Report •

Related Solutions


Ask Question