<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bat File in Operating System - Microsoft</title>
    <link>https://community.hpe.com/t5/operating-system-microsoft/bat-file/m-p/3850462#M7441</link>
    <description>Try this:&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;rem .: if your date has '/' in the date, they need to be stripped out.&lt;BR /&gt;for /f "delims='/'" %%i in ('%date%') do&lt;BR /&gt;set my_date=%%i%%j%%k&lt;BR /&gt;set my_file=CURRDATA%my_date%.txt&lt;BR /&gt;&lt;BR /&gt;OPEN server&lt;BR /&gt;dwftp&lt;BR /&gt;&lt;BR /&gt;lcd \\server\targetdir&lt;BR /&gt;status&lt;BR /&gt;PUT CURRDATA.txt %my_file%&lt;BR /&gt;bye&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;&lt;BR /&gt;If you need to use a script file to run rather than issue the commands directly, you can echo the commands out to a file like below:&lt;BR /&gt;&lt;BR /&gt;---------------------------------------&lt;BR /&gt;set /P my_loc="Please enter FTP site: "&lt;BR /&gt;set /P my_id="Please enter your ID: "&lt;BR /&gt;set /P my_pass="Please enter your Password: "&lt;BR /&gt;&lt;BR /&gt;echo open %my_loc% &amp;gt; ftp_conn.txt&lt;BR /&gt;echo user %my_id% %my_pass%&amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo binary &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo hash &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo put %my_date%.zip &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo close &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo quit &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;&lt;BR /&gt;ftp -s:ftp_conn.txt&lt;BR /&gt;&lt;BR /&gt;del ftp_conn.txt&lt;BR /&gt;del %my_date%.zip&lt;BR /&gt;--------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Jon</description>
    <pubDate>Fri, 25 Aug 2006 11:14:01 GMT</pubDate>
    <dc:creator>Jon Finley</dc:creator>
    <dc:date>2006-08-25T11:14:01Z</dc:date>
    <item>
      <title>Bat File</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/bat-file/m-p/3850461#M7440</link>
      <description>&lt;!--!*#--&gt;I have a .bat file on a Windows XP Pro platform that will FTP a file to another server.  I would like to know how to rename the file by appending the current date to the filename before the put command.&lt;BR /&gt;&lt;BR /&gt;Here is what I am doing/want to do:&lt;BR /&gt;&lt;BR /&gt;OPEN server  &lt;BR /&gt;dwftp &lt;BR /&gt;*****&lt;BR /&gt;lcd \\server\targetdir&lt;BR /&gt;status&lt;BR /&gt;PUT CURRDATA.txt CURRDATA_08252006.txt&lt;BR /&gt;bye&lt;BR /&gt;&lt;BR /&gt;So, I need to put the date in a variable and append the variable to the filename somehow.  I don't want to have to edit the .bat daily to change the date.  The .bat file will run automatically each evening.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Sue&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Aug 2006 06:57:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/bat-file/m-p/3850461#M7440</guid>
      <dc:creator>Sue OLoughlin</dc:creator>
      <dc:date>2006-08-25T06:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Bat File</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/bat-file/m-p/3850462#M7441</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;------------------------------------------&lt;BR /&gt;rem .: if your date has '/' in the date, they need to be stripped out.&lt;BR /&gt;for /f "delims='/'" %%i in ('%date%') do&lt;BR /&gt;set my_date=%%i%%j%%k&lt;BR /&gt;set my_file=CURRDATA%my_date%.txt&lt;BR /&gt;&lt;BR /&gt;OPEN server&lt;BR /&gt;dwftp&lt;BR /&gt;&lt;BR /&gt;lcd \\server\targetdir&lt;BR /&gt;status&lt;BR /&gt;PUT CURRDATA.txt %my_file%&lt;BR /&gt;bye&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;&lt;BR /&gt;If you need to use a script file to run rather than issue the commands directly, you can echo the commands out to a file like below:&lt;BR /&gt;&lt;BR /&gt;---------------------------------------&lt;BR /&gt;set /P my_loc="Please enter FTP site: "&lt;BR /&gt;set /P my_id="Please enter your ID: "&lt;BR /&gt;set /P my_pass="Please enter your Password: "&lt;BR /&gt;&lt;BR /&gt;echo open %my_loc% &amp;gt; ftp_conn.txt&lt;BR /&gt;echo user %my_id% %my_pass%&amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo binary &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo hash &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo put %my_date%.zip &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo close &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;echo quit &amp;gt;&amp;gt; ftp_conn.txt&lt;BR /&gt;&lt;BR /&gt;ftp -s:ftp_conn.txt&lt;BR /&gt;&lt;BR /&gt;del ftp_conn.txt&lt;BR /&gt;del %my_date%.zip&lt;BR /&gt;--------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Jon</description>
      <pubDate>Fri, 25 Aug 2006 11:14:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/bat-file/m-p/3850462#M7441</guid>
      <dc:creator>Jon Finley</dc:creator>
      <dc:date>2006-08-25T11:14:01Z</dc:date>
    </item>
  </channel>
</rss>

