Saved Bookmarks
| 1. |
Solve : Can someone provide batch code?? |
|
Answer» 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.... %date% is a system set VARIABLE that gives the date. what is your output if you use Code: [Select]echo %date% in cmd ?Sat 02/21/2009Since you didn't specify, I assume the MP3 files are in the current directory, and the files should go to the DEFAULT FTP directory. You should be able to do something like this: Code: [Select]@echo off setlocal enabledelayedexpansion set FTPHost=myftphost.com set FTPUser=myusername set FTPPass=mypassword set MonthNum=%date:~4,2% set DayNum=%date:~7,2% set Loop=1 for %%a in (Jan Feb Mar Apr MAY Jun Jul Aug Sep Oct Nov Dec) do ( if !MonthNum! equ !Loop! set MONTH=%%a set /a Loop+=1 ) set File=%Month%%DayNum%.mp3 echo %FTPUser%>cmds.ftp echo %FTPPass%>>cmds.ftp echo bin>>cmds.ftp echo put %File% rw.mp3>>cmds.ftp echo quit>>cmds.ftp ftp -v -s:cmds.ftp %FTPHost% echo Done transferring %File%Thank you Gary... I appreciate your helping me. bob No problem.GuruGary is very HELPFUL. Always posts a tested batch file in those threads that he can help with. |
|