Loading ...
Sorry, an error occurred while loading the content.

Re: [BATCH WORLD] Date concatenated into file name for backup

Expand Messages
  • Michael Marquart
    Is this what you mean? copy filename.txt filename%date%.txt or ren filename.txt filename%date%.txt
    Message 1 of 17 , Nov 1, 2001
    • 0 Attachment
      Is this what you mean?

      copy filename.txt filename%date%.txt

      or

      ren filename.txt filename%date%.txt

      On Wed, 31 Oct 2001 21:59:27 -0000, ausdahl@... wrote:

      >I have been researching for a couple of days now but found no direct
      >answer to how to do this (some things came close, but no cigar). I
      >have the date in a variable, I cannot find the syntax in the copy
      >statement to concatenate the date into the file name
      >(e.g. ab%date%.txt). Any help would be appreciated.
      >Thanks...
    • Kenneth C Mazie
      Try this. You will likely need to adjust the batch file to rename the file in the form you need, i.e. date first or last. This will work for a single file
      Message 2 of 17 , Nov 1, 2001
      • 0 Attachment
        Try this. You will likely need to adjust the batch file to rename the file in the form you need, i.e. date first or last. This will work for a single file also, just get rid of the "list" section. This batch works on NT4 or Win2k.
        ============== batch code ===========================
        @echo off
        cls
        :: Filename = Datestamp.bat
        :: Description = Appends todays date & time to all files in target directory
        :: Author = Kenneth C. Mazie
        :: Date = 04-06-01
        :: Version = 1.0

        :begin
        set target=c:\temp2

        :get date & time
        FOR /F "TOKENS=1,2*" %%A IN ('DATE/T') DO SET DATE=%%B
        SET DATE=%DATE:/=-%
        FOR /F "TOKENS=*" %%A IN ('TIME/T') DO SET TIME=%%A
        SET TIME=%TIME::=%
        set TODAY=%date%-%TIME%

        :list
        for /F %%I in ('DIR %target% /B') do Call :rename %%I
        goto exit

        :rename
        ren %target%\%1 %TODAY%-%1

        :exit
        ====================end of batch================================

        Ken Mazie MCSE/CNE
        Kaiser Permanente Server Engineering
        ===================================================





        I have been researching for a couple of days now but found no direct
        answer to how to do this (some things came close, but no cigar). I
        have the date in a variable, I cannot find the syntax in the copy
        statement to concatenate the date into the file name
        (e.g. ab%date%.txt). Any help would be appreciated.
        Thanks...


        To Post a message, send it to: batchworld@...

        To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • Ausdahl, Gary
        Exactly. I have the date in a env var without the slashes (verified via echo ). But when I use the format below (gl%DATE%.txt), it tells me the syntax of the
        Message 3 of 17 , Nov 1, 2001
        • 0 Attachment
          RE: [BATCH WORLD] Date concatenated into file name for backup

          Exactly. I have the date in a env var without the slashes (verified via 'echo'). But when I use the format below (gl%DATE%.txt), it tells me the syntax of the command is incorrect. I can copy the file simply using %DATE%. It is when I try to include the date in the filename that it gives me an error. This is on an NT 4.0 server.

          Thanks,
          Gary Ausdahl
          (480) 754-6793
          Ausdahl@...

              -----Original Message-----
              From:   Michael Marquart [mailto:micm@...]
              Sent:   Thursday, November 01, 2001 5:00 AM
              To:     batchworld@yahoogroups.com
              Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup


              Is this what you mean?

              copy filename.txt filename%date%.txt

              or

              ren filename.txt filename%date%.txt

              On Wed, 31 Oct 2001 21:59:27 -0000, ausdahl@... wrote:

              >I have been researching for a couple of days now but found no direct
              >answer to how to do this (some things came close, but no cigar). I
              >have the date in a variable, I cannot find the syntax in the copy
              >statement to concatenate the date into the file name
              >(e.g. ab%date%.txt). Any help would be appreciated.
              >Thanks...



              To Post a message, send it to:   batchworld@...

              To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

        • Michael Marquart
          Post your syntax here, to see if someone can spot the problem. Also, use echo %date% to see if there is a leading or trailing or embedded space/tab. There
          Message 4 of 17 , Nov 1, 2001
          • 0 Attachment
            Post your syntax here, to see if someone can spot the problem.

            Also, use
            echo "%date%"
            to see if there is a leading or trailing or embedded space/tab.

            There are no :,/,\ characters in it are there?

            Try enclosing the target filename in quote marks

            ren gl.txt "gl%date%.txt"


            Michael

            On Thu, 1 Nov 2001 09:55:12 -0700, "Ausdahl, Gary" <ausdahl@...>
            wrote:

            >Exactly. I have the date in a env var without the slashes (verified via
            >'echo'). But when I use the format below (gl%DATE%.txt), it tells me the
            >syntax of the command is incorrect. I can copy the file simply using %DATE%.
            >It is when I try to include the date in the filename that it gives me an
            >error. This is on an NT 4.0 server.
            >Thanks,
            >Gary Ausdahl
            >(480) 754-6793
            >Ausdahl@... <mailto:Ausdahl@...>
            >
            > -----Original Message-----
            > From: Michael Marquart [mailto:micm@...]
            > Sent: Thursday, November 01, 2001 5:00 AM
            > To: batchworld@yahoogroups.com
            > Subject: Re: [BATCH WORLD] Date concatenated into
            >file name for backup
            >
            >
            > Is this what you mean?
            >
            > copy filename.txt filename%date%.txt
            >
            > or
            >
            > ren filename.txt filename%date%.txt
            >
            > On Wed, 31 Oct 2001 21:59:27 -0000, ausdahl@...
            >wrote:
            >
            > >I have been researching for a couple of days now but found
            >no direct
            > >answer to how to do this (some things came close, but no
            >cigar). I
            > >have the date in a variable, I cannot find the syntax in
            >the copy
            > >statement to concatenate the date into the file name
            > >(e.g. ab%date%.txt). Any help would be appreciated.
            > >Thanks...
            >
            >
          • Ausdahl, Gary
            You just hit the nail on the head. I enclosed the entire target path in double quotes and it worked! That is one combination I may not have tried. I would have
            Message 5 of 17 , Nov 1, 2001
            • 0 Attachment
              RE: [BATCH WORLD] Date concatenated into file name for backup

              You just hit the nail on the head. I enclosed the entire target path in double quotes and it worked!
              That is one combination I may not have tried. I would have thought if target had to be in quotes, so would the source - oh well, whatever works.

              Thanks much!
              Gary Ausdahl
              (480) 754-6793
              Ausdahl@...

                  -----Original Message-----
                  From:   Michael Marquart [mailto:micm@...]
                  Sent:   Thursday, November 01, 2001 10:14 AM
                  To:     batchworld@yahoogroups.com
                  Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup



                  Post your syntax here, to see if someone can spot the problem.

                  Also, use
                  echo "%date%"
                  to see if there is a leading or trailing or embedded space/tab.

                  There are no :,/,\ characters in it are there?

                  Try enclosing the target filename in quote marks

                  ren gl.txt "gl%date%.txt"


                  Michael

                  On Thu, 1 Nov 2001 09:55:12 -0700, "Ausdahl, Gary" <ausdahl@...>
                  wrote:

                  >Exactly. I have the date in a env var without the slashes (verified via
                  >'echo'). But when I use the format below (gl%DATE%.txt), it tells me the
                  >syntax of the command is incorrect. I can copy the file simply using %DATE%.
                  >It is when I try to include the date in the filename that it gives me an
                  >error. This is on an NT 4.0 server.
                  >Thanks,
                  >Gary Ausdahl
                  >(480) 754-6793
                  >Ausdahl@... <mailto:Ausdahl@...>
                  >
                  >               -----Original Message-----
                  >               From:   Michael Marquart [mailto:micm@...]
                  >               Sent:   Thursday, November 01, 2001 5:00 AM
                  >               To:     batchworld@yahoogroups.com
                  >               Subject:        Re: [BATCH WORLD] Date concatenated into
                  >file name for backup
                  >
                  >
                  >               Is this what you mean?
                  >
                  >               copy filename.txt filename%date%.txt
                  >
                  >               or
                  >
                  >               ren filename.txt filename%date%.txt
                  >
                  >               On Wed, 31 Oct 2001 21:59:27 -0000, ausdahl@...
                  >wrote:
                  >
                  >               >I have been researching for a couple of days now but found
                  >no direct
                  >               >answer to how to do this (some things came close, but no
                  >cigar). I
                  >               >have the date in a variable, I cannot find the syntax in
                  >the copy
                  >               >statement to concatenate the date into the file name
                  >               >(e.g. ab%date%.txt). Any help would be appreciated.
                  >               >Thanks...
                  >
                  >


                  To Post a message, send it to:   batchworld@...

                  To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                  Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

            • Michael Marquart
              Ahhh... I m guessing the path is where the space is. If there are no spaces or other irregular characters (;=, etc) in the path or filename then the double
              Message 6 of 17 , Nov 1, 2001
              • 0 Attachment
                Ahhh... I'm guessing the path is where the space is.

                If there are no spaces or other irregular characters (;=, etc) in the path or
                filename then the double quotes aren't required.

                Glad I could help.

                Michael

                On Thu, 1 Nov 2001 10:25:13 -0700, "Ausdahl, Gary" <ausdahl@...>
                wrote:

                >You just hit the nail on the head. I enclosed the entire target path in
                >double quotes and it worked!
                >That is one combination I may not have tried. I would have thought if target
                >had to be in quotes, so would the source - oh well, whatever works.
                >Thanks much!
                >Gary Ausdahl
                >(480) 754-6793
                >Ausdahl@... <mailto:Ausdahl@...>
                >
                > -----Original Message-----
                > From: Michael Marquart [mailto:micm@...]
                > Sent: Thursday, November 01, 2001 10:14 AM
                > To: batchworld@yahoogroups.com
                > Subject: Re: [BATCH WORLD] Date concatenated into
                >file name for backup
                >
                >
                >
                > Post your syntax here, to see if someone can spot the
                >problem.
                >
                > Also, use
                > echo "%date%"
                > to see if there is a leading or trailing or embedded
                >space/tab.
                >
                > There are no :,/,\ characters in it are there?
                >
                > Try enclosing the target filename in quote marks
                >
                > ren gl.txt "gl%date%.txt"
                >
                >
                > Michael
                >
                > On Thu, 1 Nov 2001 09:55:12 -0700, "Ausdahl, Gary"
                ><ausdahl@...>
                > wrote:
                >
                > >Exactly. I have the date in a env var without the slashes
                >(verified via
                > >'echo'). But when I use the format below (gl%DATE%.txt), it
                >tells me the
                > >syntax of the command is incorrect. I can copy the file
                >simply using %DATE%.
                > >It is when I try to include the date in the filename that
                >it gives me an
                > >error. This is on an NT 4.0 server.
                > >Thanks,
                > >Gary Ausdahl
                > >(480) 754-6793
                > >Ausdahl@... <mailto:Ausdahl@...>
                > >
                > > -----Original Message-----
                > > From: Michael Marquart
                >[mailto:micm@...]
                > > Sent: Thursday, November 01, 2001 5:00 AM
                > > To: batchworld@yahoogroups.com
                > > Subject: Re: [BATCH WORLD] Date
                >concatenated into
                > >file name for backup
                > >
                > >
                > > Is this what you mean?
                > >
                > > copy filename.txt filename%date%.txt
                > >
                > > or
                > >
                > > ren filename.txt filename%date%.txt
                > >
                > > On Wed, 31 Oct 2001 21:59:27 -0000,
                >ausdahl@...
                > >wrote:
                > >
                > > >I have been researching for a couple of
                >days now but found
                > >no direct
                > > >answer to how to do this (some things came
                >close, but no
                > >cigar). I
                > > >have the date in a variable, I cannot find
                >the syntax in
                > >the copy
                > > >statement to concatenate the date into the
                >file name
                > > >(e.g. ab%date%.txt). Any help would be
                >appreciated.
                > > >Thanks...
                > >
                > >
              • Ausdahl, Gary
                Well, I don t understand it. I see no spaces or unusual characters (except for the space between source and target). This is the line that does not work
                Message 7 of 17 , Nov 1, 2001
                • 0 Attachment
                  RE: [BATCH WORLD] Date concatenated into file name for backup

                  Well, I don't understand it. I see no spaces or unusual characters (except for the space between source and target). This is the line that does not work (incorrect syntax):

                  COPY OutputFiles\GLOUTPUT.txt OutputFiles\gl_backup\gl%date%.txt

                  This is the line that does work:
                  COPY OutputFiles\GLOUTPUT.txt "OutputFiles\gl_backup\gl%date%.txt"

                  The only difference is the double quotes around the target. I'm just glad it works.
                  Thanks,
                  Gary Ausdahl
                  (480) 754-6793
                  Ausdahl@...

                      -----Original Message-----
                      From:   Michael Marquart [mailto:micm@...]
                      Sent:   Thursday, November 01, 2001 10:32 AM
                      To:     batchworld@yahoogroups.com
                      Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup


                      Ahhh...  I'm guessing the path is where the space is.

                      If there are no spaces or other irregular characters (;=, etc) in the path or
                      filename then the double quotes aren't required.

                      Glad I could help.

                      Michael

                      On Thu, 1 Nov 2001 10:25:13 -0700, "Ausdahl, Gary" <ausdahl@...>
                      wrote:

                      >You just hit the nail on the head. I enclosed the entire target path in
                      >double quotes and it worked!
                      >That is one combination I may not have tried. I would have thought if target
                      >had to be in quotes, so would the source - oh well, whatever works.
                      >Thanks much!
                      >Gary Ausdahl
                      >(480) 754-6793
                      >Ausdahl@... <mailto:Ausdahl@...>
                      >
                      >               -----Original Message-----
                      >               From:   Michael Marquart [mailto:micm@...]
                      >               Sent:   Thursday, November 01, 2001 10:14 AM
                      >               To:     batchworld@yahoogroups.com
                      >               Subject:        Re: [BATCH WORLD] Date concatenated into
                      >file name for backup
                      >
                      >
                      >
                      >               Post your syntax here, to see if someone can spot the
                      >problem.
                      >
                      >               Also, use
                      >               echo "%date%"
                      >               to see if there is a leading or trailing or embedded
                      >space/tab.
                      >
                      >               There are no :,/,\ characters in it are there?
                      >
                      >               Try enclosing the target filename in quote marks
                      >
                      >               ren gl.txt "gl%date%.txt"
                      >
                      >
                      >               Michael
                      >
                      >               On Thu, 1 Nov 2001 09:55:12 -0700, "Ausdahl, Gary"
                      ><ausdahl@...>
                      >               wrote:
                      >
                      >               >Exactly. I have the date in a env var without the slashes
                      >(verified via
                      >               >'echo'). But when I use the format below (gl%DATE%.txt), it
                      >tells me the
                      >               >syntax of the command is incorrect. I can copy the file
                      >simply using %DATE%.
                      >               >It is when I try to include the date in the filename that
                      >it gives me an
                      >               >error. This is on an NT 4.0 server.
                      >               >Thanks,
                      >               >Gary Ausdahl
                      >               >(480) 754-6793
                      >               >Ausdahl@... <mailto:Ausdahl@...>
                      >               >
                      >               >               -----Original Message-----
                      >               >               From:   Michael Marquart
                      >[mailto:micm@...]
                      >               >               Sent:   Thursday, November 01, 2001 5:00 AM
                      >               >               To:     batchworld@yahoogroups.com
                      >               >               Subject:        Re: [BATCH WORLD] Date
                      >concatenated into
                      >               >file name for backup
                      >               >
                      >               >
                      >               >               Is this what you mean?
                      >               >
                      >               >               copy filename.txt filename%date%.txt
                      >               >
                      >               >               or
                      >               >
                      >               >               ren filename.txt filename%date%.txt
                      >               >
                      >               >               On Wed, 31 Oct 2001 21:59:27 -0000,
                      >ausdahl@...
                      >               >wrote:
                      >               >
                      >               >               >I have been researching for a couple of
                      >days now but found
                      >               >no direct
                      >               >               >answer to how to do this (some things came
                      >close, but no
                      >               >cigar). I
                      >               >               >have the date in a variable, I cannot find
                      >the syntax in
                      >               >the copy
                      >               >               >statement to concatenate the date into the
                      >file name
                      >               >               >(e.g. ab%date%.txt). Any help would be
                      >appreciated.
                      >               >               >Thanks...
                      >               >
                      >               >


                      To Post a message, send it to:   batchworld@...

                      To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                • Michael Marquart
                  If you want to persue it, my money is on the contents of the date environment variable. It must contain an odd character. a %,;:/ =|+ etc Michael On Thu, 1
                  Message 8 of 17 , Nov 1, 2001
                  • 0 Attachment
                    If you want to persue it, my money is on the contents of the date environment
                    variable. It "must" contain an odd character. a %,;:/\=|+ etc


                    Michael

                    On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl, Gary" <ausdahl@...>
                    wrote:

                    >Well, I don't understand it. I see no spaces or unusual characters (except
                    >for the space between source and target). This is the line that does not
                    >work (incorrect syntax):
                    >COPY OutputFiles\GLOUTPUT.txt OutputFiles\gl_backup\gl%date%.txt
                    >
                    >This is the line that does work:
                    >COPY OutputFiles\GLOUTPUT.txt "OutputFiles\gl_backup\gl%date%.txt"
                    >
                    >The only difference is the double quotes around the target. I'm just glad it
                    >works.
                    >Thanks,
                    >Gary Ausdahl
                    >(480) 754-6793
                    >Ausdahl@... <mailto:Ausdahl@...>
                  • Ausdahl, Gary
                    That would make sense, but the display doesn t seem to show it. I wonder if it is at the end; but why would there be a space in an envvar? Below is the entire
                    Message 9 of 17 , Nov 1, 2001
                    • 0 Attachment
                      RE: [BATCH WORLD] Date concatenated into file name for backup

                      That would make sense, but the display doesn't seem to show it. I wonder if it is at the end; but why would there be a space in an envvar? Below is the entire bat file. Pretty simple actually:

                      @ECHO OFF
                      FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
                      REM Remove '/' from date
                      SET DATE=%DATE:/=%
                      ECHO It's %DATE% today
                      COPY OutputFiles\GLOUTPUT.txt "OutputFiles\gl_backup\gl%date%.txt"

                      Gary Ausdahl
                      (480) 754-6793
                      Ausdahl@...

                          -----Original Message-----
                          From:   Michael Marquart [mailto:micm@...]
                          Sent:   Thursday, November 01, 2001 11:10 AM
                          To:     batchworld@yahoogroups.com
                          Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup


                          If you want to persue it, my money is on the contents of the date environment
                          variable.  It "must" contain an odd character. a %,;:/\=|+ etc


                          Michael

                          On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl, Gary" <ausdahl@...>
                          wrote:

                          >Well, I don't understand it. I see no spaces or unusual characters (except
                          >for the space between source and target). This is the line that does not
                          >work (incorrect syntax):
                          >COPY OutputFiles\GLOUTPUT.txt OutputFiles\gl_backup\gl%date%.txt
                          >
                          >This is the line that does work:
                          >COPY OutputFiles\GLOUTPUT.txt "OutputFiles\gl_backup\gl%date%.txt"
                          >
                          >The only difference is the double quotes around the target. I'm just glad it
                          >works.
                          >Thanks,
                          >Gary Ausdahl
                          >(480) 754-6793
                          >Ausdahl@... <mailto:Ausdahl@...>


                          To Post a message, send it to:   batchworld@...

                          To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                    • Michael Marquart
                      try echo %date% and see what it shows. On Thu, 1 Nov 2001 11:18:14 -0700, Ausdahl, Gary
                      Message 10 of 17 , Nov 1, 2001
                      • 0 Attachment
                        try

                        echo "%date%"

                        and see what it shows.


                        On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl, Gary" <ausdahl@...>
                        wrote:

                        >That would make sense, but the display doesn't seem to show it. I wonder if
                        >it is at the end; but why would there be a space in an envvar? Below is the
                        >entire bat file. Pretty simple actually:
                        >@ECHO OFF
                        >FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
                        >REM Remove '/' from date
                        >SET DATE=%DATE:/=%
                        >ECHO It's %DATE% today
                        >COPY OutputFiles\GLOUTPUT.txt "OutputFiles\gl_backup\gl%date%.txt"
                        >
                        >Gary Ausdahl
                        >(480) 754-6793
                        >Ausdahl@... <mailto:Ausdahl@...>
                        >
                        > -----Original Message-----
                        > From: Michael Marquart [mailto:micm@...]
                        > Sent: Thursday, November 01, 2001 11:10 AM
                        > To: batchworld@yahoogroups.com
                        > Subject: Re: [BATCH WORLD] Date concatenated into
                        >file name for backup
                        >
                        >
                        > If you want to persue it, my money is on the contents of the
                        >date environment
                        > variable. It "must" contain an odd character. a %,;:/\=|+
                        >etc
                        >
                        >
                        > Michael
                        >
                        > On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl, Gary"
                        ><ausdahl@...>
                        > wrote:
                        >
                        > >Well, I don't understand it. I see no spaces or unusual
                        >characters (except
                        > >for the space between source and target). This is the line
                        >that does not
                        > >work (incorrect syntax):
                        > >COPY OutputFiles\GLOUTPUT.txt
                        >OutputFiles\gl_backup\gl%date%.txt
                        > >
                        > >This is the line that does work:
                        > >COPY OutputFiles\GLOUTPUT.txt
                        >"OutputFiles\gl_backup\gl%date%.txt"
                        > >
                        > >The only difference is the double quotes around the target.
                        >I'm just glad it
                        > >works.
                        > >Thanks,
                        > >Gary Ausdahl
                      • Ausdahl, Gary
                        Bingo - right again. Any idea why that would be there? Thanks again... Gary Ausdahl (480) 754-6793 Ausdahl@dialcorp.com ... From:
                        Message 11 of 17 , Nov 1, 2001
                        • 0 Attachment
                          RE: [BATCH WORLD] Date concatenated into file name for backup

                          Bingo - right again. Any idea why that would be there?
                          Thanks again...

                          Gary Ausdahl
                          (480) 754-6793
                          Ausdahl@...

                              -----Original Message-----
                              From:   Michael Marquart [mailto:micm@...]
                              Sent:   Thursday, November 01, 2001 11:24 AM
                              To:     batchworld@yahoogroups.com
                              Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup


                              try

                              echo "%date%"

                              and see what it shows.


                              On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl, Gary" <ausdahl@...>
                              wrote:

                              >That would make sense, but the display doesn't seem to show it. I wonder if
                              >it is at the end; but why would there be a space in an envvar? Below is the
                              >entire bat file. Pretty simple actually:
                              >@ECHO OFF
                              >FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
                              >REM Remove '/' from date
                              >SET DATE=%DATE:/=%
                              >ECHO It's %DATE% today
                              >COPY OutputFiles\GLOUTPUT.txt "OutputFiles\gl_backup\gl%date%.txt"
                              >
                              >Gary Ausdahl
                              >(480) 754-6793
                              >Ausdahl@... <mailto:Ausdahl@...>
                              >
                              >               -----Original Message-----
                              >               From:   Michael Marquart [mailto:micm@...]
                              >               Sent:   Thursday, November 01, 2001 11:10 AM
                              >               To:     batchworld@yahoogroups.com
                              >               Subject:        Re: [BATCH WORLD] Date concatenated into
                              >file name for backup
                              >
                              >
                              >               If you want to persue it, my money is on the contents of the
                              >date environment
                              >               variable.  It "must" contain an odd character. a %,;:/\=|+
                              >etc
                              >
                              >
                              >               Michael
                              >
                              >               On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl, Gary"
                              ><ausdahl@...>
                              >               wrote:
                              >
                              >               >Well, I don't understand it. I see no spaces or unusual
                              >characters (except
                              >               >for the space between source and target). This is the line
                              >that does not
                              >               >work (incorrect syntax):
                              >               >COPY OutputFiles\GLOUTPUT.txt
                              >OutputFiles\gl_backup\gl%date%.txt
                              >               >
                              >               >This is the line that does work:
                              >               >COPY OutputFiles\GLOUTPUT.txt
                              >"OutputFiles\gl_backup\gl%date%.txt"
                              >               >
                              >               >The only difference is the double quotes around the target.
                              >I'm just glad it
                              >               >works.
                              >               >Thanks,
                              >               >Gary Ausdahl


                              To Post a message, send it to:   batchworld@...

                              To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                        • Michael Marquart
                          I m not an NT bod, but I d say it s the delimiter you re using in the for in do - it s a space. try Ken s sample a few message back for a different slant on
                          Message 12 of 17 , Nov 1, 2001
                          • 0 Attachment
                            I'm not an NT bod, but I'd say it's the delimiter you're using in the for in
                            do - it's a space. try Ken's sample a few message back for a different slant
                            on it, or use / as a delimiter and add another token or so.

                            Michael

                            On Thu, 1 Nov 2001 11:29:16 -0700, "Ausdahl, Gary" <ausdahl@...>
                            wrote:

                            >Bingo - right again. Any idea why that would be there?
                            >Thanks again...
                            >
                            >Gary Ausdahl
                            >(480) 754-6793
                            >Ausdahl@... <mailto:Ausdahl@...>
                            >
                            > -----Original Message-----
                            > From: Michael Marquart [mailto:micm@...]
                            > Sent: Thursday, November 01, 2001 11:24 AM
                            > To: batchworld@yahoogroups.com
                            > Subject: Re: [BATCH WORLD] Date concatenated into
                            >file name for backup
                            >
                            >
                            > try
                            >
                            > echo "%date%"
                            >
                            > and see what it shows.
                            >
                            >
                            > On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl, Gary"
                            ><ausdahl@...>
                            > wrote:
                            >
                            > >That would make sense, but the display doesn't seem to show
                            >it. I wonder if
                            > >it is at the end; but why would there be a space in an
                            >envvar? Below is the
                            > >entire bat file. Pretty simple actually:
                            > >@ECHO OFF
                            > >FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET
                            >DATE=%%B
                            > >REM Remove '/' from date
                            > >SET DATE=%DATE:/=%
                            > >ECHO It's %DATE% today
                            > >COPY OutputFiles\GLOUTPUT.txt
                            >"OutputFiles\gl_backup\gl%date%.txt"
                            > >
                            > >Gary Ausdahl
                            > >(480) 754-6793
                            > >Ausdahl@... <mailto:Ausdahl@...>
                            > >
                            > > -----Original Message-----
                            > > From: Michael Marquart
                            >[mailto:micm@...]
                            > > Sent: Thursday, November 01, 2001 11:10 AM
                            > > To: batchworld@yahoogroups.com
                            > > Subject: Re: [BATCH WORLD] Date
                            >concatenated into
                            > >file name for backup
                            > >
                            > >
                            > > If you want to persue it, my money is on the
                            >contents of the
                            > >date environment
                            > > variable. It "must" contain an odd
                            >character. a %,;:/\=|+
                            > >etc
                            > >
                            > >
                            > > Michael
                            > >
                            > > On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl,
                            >Gary"
                            > ><ausdahl@...>
                            > > wrote:
                            > >
                            > > >Well, I don't understand it. I see no
                            >spaces or unusual
                            > >characters (except
                            > > >for the space between source and target).
                            >This is the line
                            > >that does not
                            > > >work (incorrect syntax):
                            > > >COPY OutputFiles\GLOUTPUT.txt
                            > >OutputFiles\gl_backup\gl%date%.txt
                            > > >
                            > > >This is the line that does work:
                            > > >COPY OutputFiles\GLOUTPUT.txt
                            > >"OutputFiles\gl_backup\gl%date%.txt"
                            > > >
                            > > >The only difference is the double quotes
                            >around the target.
                            > >I'm just glad it
                            > > >works.
                            > > >Thanks,
                            > > >Gary Ausdahl
                            >
                            >
                            > To Post a message, send it to: batchworld@...
                            >
                            > To Unsubscribe, send a blank message to:
                            >batchworld-unsubscribe@...
                            >
                            > Your use of Yahoo! Groups is subject to
                            >http://docs.yahoo.com/info/terms/
                            >
                          • Ausdahl, Gary
                            Well, I tried it and it didn t make any difference (as far as the space at the end. I then tried removing the delims reference - that didn t help either. It
                            Message 13 of 17 , Nov 1, 2001
                            • 0 Attachment
                              RE: [BATCH WORLD] Date concatenated into file name for backup

                              Well, I tried it and it didn't make any difference (as far as the space at the end. I then tried removing the delims reference - that didn't help either. It could be an NT thing. I'll have to research that a little more when I have time. The improtant thing is that it works.

                              Thanks to all...
                              Gary Ausdahl
                              (480) 754-6793
                              Ausdahl@...

                                  -----Original Message-----
                                  From:   Michael Marquart [mailto:micm@...]
                                  Sent:   Thursday, November 01, 2001 11:32 AM
                                  To:     batchworld@yahoogroups.com
                                  Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup



                                  I'm not an NT bod, but I'd say it's the delimiter you're using in the for in
                                  do - it's a space.  try Ken's sample a few message back for a different slant
                                  on it, or use / as a delimiter and add another token or so.

                                  Michael

                                  On Thu, 1 Nov 2001 11:29:16 -0700, "Ausdahl, Gary" <ausdahl@...>
                                  wrote:

                                  >Bingo - right again. Any idea why that would be there?
                                  >Thanks again...
                                  >
                                  >Gary Ausdahl
                                  >(480) 754-6793
                                  >Ausdahl@... <mailto:Ausdahl@...>
                                  >
                                  >               -----Original Message-----
                                  >               From:   Michael Marquart [mailto:micm@...]
                                  >               Sent:   Thursday, November 01, 2001 11:24 AM
                                  >               To:     batchworld@yahoogroups.com
                                  >               Subject:        Re: [BATCH WORLD] Date concatenated into
                                  >file name for backup
                                  >
                                  >
                                  >               try
                                  >
                                  >               echo "%date%"
                                  >
                                  >               and see what it shows.
                                  >
                                  >
                                  >               On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl, Gary"
                                  ><ausdahl@...>
                                  >               wrote:
                                  >
                                  >               >That would make sense, but the display doesn't seem to show
                                  >it. I wonder if
                                  >               >it is at the end; but why would there be a space in an
                                  >envvar? Below is the
                                  >               >entire bat file. Pretty simple actually:
                                  >               >@ECHO OFF
                                  >               >FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET
                                  >DATE=%%B
                                  >               >REM Remove '/' from date
                                  >               >SET DATE=%DATE:/=%
                                  >               >ECHO It's %DATE% today
                                  >               >COPY OutputFiles\GLOUTPUT.txt
                                  >"OutputFiles\gl_backup\gl%date%.txt"
                                  >               >
                                  >               >Gary Ausdahl
                                  >               >(480) 754-6793
                                  >               >Ausdahl@... <mailto:Ausdahl@...>
                                  >               >
                                  >               >               -----Original Message-----
                                  >               >               From:   Michael Marquart
                                  >[mailto:micm@...]
                                  >               >               Sent:   Thursday, November 01, 2001 11:10 AM
                                  >               >               To:     batchworld@yahoogroups.com
                                  >               >               Subject:        Re: [BATCH WORLD] Date
                                  >concatenated into
                                  >               >file name for backup
                                  >               >
                                  >               >
                                  >               >               If you want to persue it, my money is on the
                                  >contents of the
                                  >               >date environment
                                  >               >               variable.  It "must" contain an odd
                                  >character. a %,;:/\=|+
                                  >               >etc
                                  >               >
                                  >               >
                                  >               >               Michael
                                  >               >
                                  >               >               On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl,
                                  >Gary"
                                  >               ><ausdahl@...>
                                  >               >               wrote:
                                  >               >
                                  >               >               >Well, I don't understand it. I see no
                                  >spaces or unusual
                                  >               >characters (except
                                  >               >               >for the space between source and target).
                                  >This is the line
                                  >               >that does not
                                  >               >               >work (incorrect syntax):
                                  >               >               >COPY OutputFiles\GLOUTPUT.txt
                                  >               >OutputFiles\gl_backup\gl%date%.txt
                                  >               >               >
                                  >               >               >This is the line that does work:
                                  >               >               >COPY OutputFiles\GLOUTPUT.txt
                                  >               >"OutputFiles\gl_backup\gl%date%.txt"
                                  >               >               >
                                  >               >               >The only difference is the double quotes
                                  >around the target.
                                  >               >I'm just glad it
                                  >               >               >works.
                                  >               >               >Thanks,
                                  >               >               >Gary Ausdahl
                                  >
                                  >
                                  >               To Post a message, send it to:   batchworld@...
                                  >
                                  >               To Unsubscribe, send a blank message to:
                                  >batchworld-unsubscribe@...
                                  >
                                  >               Your use of Yahoo! Groups is subject to
                                  >http://docs.yahoo.com/info/terms/
                                  >              


                                  To Post a message, send it to:   batchworld@...

                                  To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                                  Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                            • Ausdahl, Gary
                              I have another question. The date is now being properly concatenated into the filename, but I have other commands following the For in the batch file. The
                              Message 14 of 17 , Nov 5, 2001
                              • 0 Attachment
                                RE: [BATCH WORLD] Date concatenated into file name for backup

                                I have another question. The date is now being properly concatenated into the filename, but I have other commands following the 'For' in the batch file. The command immediately following the COPY is a DEL command. This used to be the first command in the bat file before adding the date/copy items you have helped me do. It is now failing on this DEL command with no explanation as to why. I have checked to see if I need some kind of command to 'end' the FOR, so I can continue with the next commands, but I have found no documentation online as to whether or not I need to do that. I am assuming I need to since the DEL command, which has been working for weeks in batch is now failing. The only thing that changed is the introduction of the FOR to get date info. See below:

                                @ECHO OFF
                                FOR /F "TOKENS=1*" %%A IN ('DATE/T') DO SET DATE=%%B
                                REM Remove '/' from date (replace '/' with nothing)
                                SET DATE=%DATE:/=%
                                COPY D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_OPEN.txt "D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\tpms_open_backup\tpms_open_%DATE%.txt"

                                DEL D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_Open_Errlog.cfm
                                DEL D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_OPEN.txt
                                set PATH=%PATH%;d:\win32app\unison\bin;d:\win32app\maestro\bin
                                set TCL_LIBRARY=d:\win32app\unison\lib
                                CALL D:\Development\dms_ver40\dms_batch\batch_standard\TPMS_Open.exe

                                The bat file used to begin with the first DEL command, now it fails there. The wrapped line (COPY) is one single line in the bat file. So, there are a total of 10 lines.

                                Thanks,
                                Gary Ausdahl
                                (480) 754-6793
                                Ausdahl@...

                                    -----Original Message-----
                                    From:   Michael Marquart [mailto:micm@...]
                                    Sent:   Thursday, November 01, 2001 11:32 AM
                                    To:     batchworld@yahoogroups.com
                                    Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup



                                    I'm not an NT bod, but I'd say it's the delimiter you're using in the for in
                                    do - it's a space.  try Ken's sample a few message back for a different slant
                                    on it, or use / as a delimiter and add another token or so.

                                    Michael

                                    On Thu, 1 Nov 2001 11:29:16 -0700, "Ausdahl, Gary" <ausdahl@...>
                                    wrote:

                                    >Bingo - right again. Any idea why that would be there?
                                    >Thanks again...
                                    >
                                    >Gary Ausdahl
                                    >(480) 754-6793
                                    >Ausdahl@... <mailto:Ausdahl@...>
                                    >
                                    >               -----Original Message-----
                                    >               From:   Michael Marquart [mailto:micm@...]
                                    >               Sent:   Thursday, November 01, 2001 11:24 AM
                                    >               To:     batchworld@yahoogroups.com
                                    >               Subject:        Re: [BATCH WORLD] Date concatenated into
                                    >file name for backup
                                    >
                                    >
                                    >               try
                                    >
                                    >               echo "%date%"
                                    >
                                    >               and see what it shows.
                                    >
                                    >
                                    >               On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl, Gary"
                                    ><ausdahl@...>
                                    >               wrote:
                                    >
                                    >               >That would make sense, but the display doesn't seem to show
                                    >it. I wonder if
                                    >               >it is at the end; but why would there be a space in an
                                    >envvar? Below is the
                                    >               >entire bat file. Pretty simple actually:
                                    >               >@ECHO OFF
                                    >               >FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET
                                    >DATE=%%B
                                    >               >REM Remove '/' from date
                                    >               >SET DATE=%DATE:/=%
                                    >               >ECHO It's %DATE% today
                                    >               >COPY OutputFiles\GLOUTPUT.txt
                                    >"OutputFiles\gl_backup\gl%date%.txt"
                                    >               >
                                    >               >Gary Ausdahl
                                    >               >(480) 754-6793
                                    >               >Ausdahl@... <mailto:Ausdahl@...>
                                    >               >
                                    >               >               -----Original Message-----
                                    >               >               From:   Michael Marquart
                                    >[mailto:micm@...]
                                    >               >               Sent:   Thursday, November 01, 2001 11:10 AM
                                    >               >               To:     batchworld@yahoogroups.com
                                    >               >               Subject:        Re: [BATCH WORLD] Date
                                    >concatenated into
                                    >               >file name for backup
                                    >               >
                                    >               >
                                    >               >               If you want to persue it, my money is on the
                                    >contents of the
                                    >               >date environment
                                    >               >               variable.  It "must" contain an odd
                                    >character. a %,;:/\=|+
                                    >               >etc
                                    >               >
                                    >               >
                                    >               >               Michael
                                    >               >
                                    >               >               On Thu, 1 Nov 2001 10:41:00 -0700, "Ausdahl,
                                    >Gary"
                                    >               ><ausdahl@...>
                                    >               >               wrote:
                                    >               >
                                    >               >               >Well, I don't understand it. I see no
                                    >spaces or unusual
                                    >               >characters (except
                                    >               >               >for the space between source and target).
                                    >This is the line
                                    >               >that does not
                                    >               >               >work (incorrect syntax):
                                    >               >               >COPY OutputFiles\GLOUTPUT.txt
                                    >               >OutputFiles\gl_backup\gl%date%.txt
                                    >               >               >
                                    >               >               >This is the line that does work:
                                    >               >               >COPY OutputFiles\GLOUTPUT.txt
                                    >               >"OutputFiles\gl_backup\gl%date%.txt"
                                    >               >               >
                                    >               >               >The only difference is the double quotes
                                    >around the target.
                                    >               >I'm just glad it
                                    >               >               >works.
                                    >               >               >Thanks,
                                    >               >               >Gary Ausdahl
                                    >
                                    >
                                    >               To Post a message, send it to:   batchworld@...
                                    >
                                    >               To Unsubscribe, send a blank message to:
                                    >batchworld-unsubscribe@...
                                    >
                                    >               Your use of Yahoo! Groups is subject to
                                    >http://docs.yahoo.com/info/terms/
                                    >              


                                    To Post a message, send it to:   batchworld@...

                                    To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                                    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                              • Michael Marquart
                                I think your problem is due to some other factor - the first 4 lines should not affect a del command which worked previously. How does it fail - are there
                                Message 15 of 17 , Nov 6, 2001
                                • 0 Attachment
                                  I think your problem is due to some other factor - the first 4 lines should
                                  not affect a del command which worked previously.

                                  How does it "fail" - are there any error messages?

                                  Try this modification:
                                  You'll note that I have made the drive and directory current before performing
                                  the main commands, to simplify reading the batch file.
                                  The other change made is where I place the %path% at the end of the line, as a
                                  precaution - the old line may have failed depending on the length of the
                                  existing %path% and so the important path variables are placed first.
                                  Finally, and most importantly, there is a pause command to allow you to see
                                  any error messages which occur prior to running the application.


                                  @ECHO OFF
                                  FOR /F "TOKENS=1*" %%A IN ('DATE/T') DO SET DATE=%%B
                                  REM Remove '/' from date (replace '/' with nothing)
                                  SET DATE=%DATE:/=%
                                  D:
                                  CD "D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles"
                                  COPY TPMS_OPEN.txt "tpms_open_backup\tpms_open_%DATE%.txt"
                                  DEL TPMS_Open_Errlog.cfm
                                  DEL TPMS_OPEN.txt
                                  set PATH=d:\win32app\unison\bin;d:\win32app\maestro\bin;%PATH%
                                  set TCL_LIBRARY=d:\win32app\unison\lib
                                  pause
                                  CALL TPMS_Open.exe

                                  Michael


                                  On Mon, 5 Nov 2001 13:00:51 -0700, "Ausdahl, Gary" <ausdahl@...>
                                  wrote:

                                  >I have another question. The date is now being properly concatenated into
                                  >the filename, but I have other commands following the 'For' in the batch
                                  >file. The command immediately following the COPY is a DEL command. This used
                                  >to be the first command in the bat file before adding the date/copy items
                                  >you have helped me do. It is now failing on this DEL command with no
                                  >explanation as to why. I have checked to see if I need some kind of command
                                  >to 'end' the FOR, so I can continue with the next commands, but I have found
                                  >no documentation online as to whether or not I need to do that. I am
                                  >assuming I need to since the DEL command, which has been working for weeks
                                  >in batch is now failing. The only thing that changed is the introduction of
                                  >the FOR to get date info. See below:
                                  >@ECHO OFF
                                  >FOR /F "TOKENS=1*" %%A IN ('DATE/T') DO SET DATE=%%B
                                  >REM Remove '/' from date (replace '/' with nothing)
                                  >SET DATE=%DATE:/=%
                                  >COPY
                                  >D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_OPEN.txt
                                  >"D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\tpms_open_bac
                                  >kup\tpms_open_%DATE%.txt"
                                  >DEL
                                  >D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_Open_Errl
                                  >og.cfm
                                  >DEL
                                  >D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_OPEN.txt
                                  >set PATH=%PATH%;d:\win32app\unison\bin;d:\win32app\maestro\bin
                                  >set TCL_LIBRARY=d:\win32app\unison\lib
                                  >CALL D:\Development\dms_ver40\dms_batch\batch_standard\TPMS_Open.exe
                                  >
                                  >The bat file used to begin with the first DEL command, now it fails there.
                                  >The wrapped line (COPY) is one single line in the bat file. So, there are a
                                  >total of 10 lines.
                                  >Thanks,
                                  >Gary Ausdahl
                                  >(480) 754-6793
                                  >Ausdahl@... <mailto:Ausdahl@...>
                                  >
                                  > -----Original Message-----
                                  > From: Michael Marquart [mailto:micm@...]
                                  > Sent: Thursday, November 01, 2001 11:32 AM
                                  > To: batchworld@yahoogroups.com
                                  > Subject: Re: [BATCH WORLD] Date concatenated into
                                  >file name for backup
                                  >
                                  >
                                  >
                                  > I'm not an NT bod, but I'd say it's the delimiter you're
                                  >using in the for in
                                  > do - it's a space. try Ken's sample a few message back for
                                  >a different slant
                                  > on it, or use / as a delimiter and add another token or so.
                                  >
                                  > Michael
                                  >
                                  > On Thu, 1 Nov 2001 11:29:16 -0700, "Ausdahl, Gary"
                                  ><ausdahl@...>
                                  > wrote:
                                  >
                                  > >Bingo - right again. Any idea why that would be there?
                                  > >Thanks again...
                                  > >
                                  > >Gary Ausdahl
                                  > >(480) 754-6793
                                  > >Ausdahl@... <mailto:Ausdahl@...>
                                  > >
                                  > > -----Original Message-----
                                  > > From: Michael Marquart
                                  >[mailto:micm@...]
                                  > > Sent: Thursday, November 01, 2001 11:24 AM
                                  > > To: batchworld@yahoogroups.com
                                  > > Subject: Re: [BATCH WORLD] Date
                                  >concatenated into
                                  > >file name for backup
                                  > >
                                  > >
                                  > > try
                                  > >
                                  > > echo "%date%"
                                  > >
                                  > > and see what it shows.
                                  > >
                                  > >
                                  > > On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl,
                                  >Gary"
                                  > ><ausdahl@...>
                                  > > wrote:
                                  > >
                                  > > >That would make sense, but the display
                                  >doesn't seem to show
                                  > >it. I wonder if
                                  > > >it is at the end; but why would there be a
                                  >space in an
                                  > >envvar? Below is the
                                  > > >entire bat file. Pretty simple actually:
                                  > > >@ECHO OFF
                                  > > >FOR /F "TOKENS=1* DELIMS= " %%A IN
                                  >('DATE/T') DO SET
                                  > >DATE=%%B
                                  > > >REM Remove '/' from date
                                  > > >SET DATE=%DATE:/=%
                                  > > >ECHO It's %DATE% today
                                  > > >COPY OutputFiles\GLOUTPUT.txt
                                  > >"OutputFiles\gl_backup\gl%date%.txt"
                                  > > >
                                  > > >Gary Ausdahl
                                  > > >(480) 754-6793
                                  > > >Ausdahl@...
                                  ><mailto:Ausdahl@...>
                                  > > >
                                  > > > -----Original Message-----
                                  > > > From: Michael Marquart
                                  > >[mailto:micm@...]
                                  > > > Sent: Thursday, November
                                  >01, 2001 11:10 AM
                                  > > > To:
                                  >batchworld@yahoogroups.com
                                  > > > Subject: Re: [BATCH
                                  >WORLD] Date
                                  > >concatenated into
                                  > > >file name for backup
                                  > > >
                                  > > >
                                  > > > If you want to persue it, my
                                  >money is on the
                                  > >contents of the
                                  > > >date environment
                                  > > > variable. It "must" contain
                                  >an odd
                                  > >character. a %,;:/\=|+
                                  > > >etc
                                  > > >
                                  > > >
                                  > > > Michael
                                  > > >
                                  > > > On Thu, 1 Nov 2001 10:41:00
                                  >-0700, "Ausdahl,
                                  > >Gary"
                                  > > ><ausdahl@...>
                                  > > > wrote:
                                  > > >
                                  > > > >Well, I don't understand
                                  >it. I see no
                                  > >spaces or unusual
                                  > > >characters (except
                                  > > > >for the space between
                                  >source and target).
                                  > >This is the line
                                  > > >that does not
                                  > > > >work (incorrect syntax):
                                  > > > >COPY
                                  >OutputFiles\GLOUTPUT.txt
                                  > > >OutputFiles\gl_backup\gl%date%.txt
                                  > > > >
                                  > > > >This is the line that does
                                  >work:
                                  > > > >COPY
                                  >OutputFiles\GLOUTPUT.txt
                                  > > >"OutputFiles\gl_backup\gl%date%.txt"
                                  > > > >
                                  > > > >The only difference is the
                                  >double quotes
                                  > >around the target.
                                  > > >I'm just glad it
                                  > > > >works.
                                  > > > >Thanks,
                                  > > > >Gary Ausdahl
                                  > >
                                  > >
                                  > > To Post a message, send it to:
                                  >batchworld@...
                                  > >
                                  > > To Unsubscribe, send a blank message to:
                                  > >batchworld-unsubscribe@...
                                  > >
                                  > > Your use of Yahoo! Groups is subject to
                                  > >http://docs.yahoo.com/info/terms/
                                  > >
                                  >
                                  >
                                  > To Post a message, send it to: batchworld@...
                                  >
                                  > To Unsubscribe, send a blank message to:
                                  >batchworld-unsubscribe@...
                                  >
                                  > Your use of Yahoo! Groups is subject to
                                  >http://docs.yahoo.com/info/terms/
                                  >
                                • Ausdahl, Gary
                                  You know it may be something else. We have this UNIX based scheduler running jobs (BAT files) on NT in production. It s called Maestro. As soon as I added the
                                  Message 16 of 17 , Nov 6, 2001
                                  • 0 Attachment
                                    RE: [BATCH WORLD] Date concatenated into file name for backup

                                    You know it may be something else. We have this UNIX based scheduler running jobs (BAT files) on NT in production. It's called Maestro. As soon as I added the copy statement, it started failing. It is returning a code of 255 for some reason. I will try to find out what that is. I will also get on the vendor site to see if they have any idea (fat chance there). This software seems to work adequately at best on NT. If you think of anything else, let me know. I will go ahead and try the mod.

                                    Thanks,
                                    Gary Ausdahl
                                    (480) 754-6793
                                    Ausdahl@...

                                        -----Original Message-----
                                        From:   Michael Marquart [mailto:micm@...]
                                        Sent:   Tuesday, November 06, 2001 5:42 AM
                                        To:     batchworld@yahoogroups.com
                                        Subject:        Re: [BATCH WORLD] Date concatenated into file name for backup


                                        I think your problem is due to some other factor - the first 4 lines should
                                        not affect a del command which worked previously.

                                        How does it "fail" - are there any error messages?

                                        Try this modification:
                                        You'll note that I have made the drive and directory current before performing
                                        the main commands, to simplify reading the batch file.
                                        The other change made is where I place the %path% at the end of the line, as a
                                        precaution - the old line may have failed depending on the length of the
                                        existing %path% and so the important path variables are placed first.
                                        Finally, and most importantly, there is a pause command to allow you to see
                                        any error messages which occur prior to running the application.


                                        @ECHO OFF
                                        FOR /F "TOKENS=1*" %%A IN ('DATE/T') DO SET DATE=%%B
                                        REM Remove '/' from date (replace '/' with nothing)
                                        SET DATE=%DATE:/=%
                                        D:
                                        CD "D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles"
                                        COPY TPMS_OPEN.txt "tpms_open_backup\tpms_open_%DATE%.txt"
                                        DEL  TPMS_Open_Errlog.cfm
                                        DEL  TPMS_OPEN.txt
                                        set PATH=d:\win32app\unison\bin;d:\win32app\maestro\bin;%PATH%
                                        set TCL_LIBRARY=d:\win32app\unison\lib
                                        pause
                                        CALL TPMS_Open.exe

                                        Michael


                                        On Mon, 5 Nov 2001 13:00:51 -0700, "Ausdahl, Gary" <ausdahl@...>
                                        wrote:

                                        >I have another question. The date is now being properly concatenated into
                                        >the filename, but I have other commands following the 'For' in the batch
                                        >file. The command immediately following the COPY is a DEL command. This used
                                        >to be the first command in the bat file before adding the date/copy items
                                        >you have helped me do. It is now failing on this DEL command with no
                                        >explanation as to why. I have checked to see if I need some kind of command
                                        >to 'end' the FOR, so I can continue with the next commands, but I have found
                                        >no documentation online as to whether or not I need to do that. I am
                                        >assuming I need to since the DEL command, which has been working for weeks
                                        >in batch is now failing. The only thing that changed is the introduction of
                                        >the FOR to get date info. See below:
                                        >@ECHO OFF
                                        >FOR /F "TOKENS=1*" %%A IN ('DATE/T') DO SET DATE=%%B
                                        >REM Remove '/' from date (replace '/' with nothing)
                                        >SET DATE=%DATE:/=%
                                        >COPY
                                        >D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_OPEN.txt
                                        >"D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\tpms_open_bac
                                        >kup\tpms_open_%DATE%.txt"
                                        >DEL
                                        >D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_Open_Errl
                                        >og.cfm
                                        >DEL
                                        >D:\Development\dms_ver40\dms_batch\batch_standard\OutputFiles\TPMS_OPEN.txt
                                        >set PATH=%PATH%;d:\win32app\unison\bin;d:\win32app\maestro\bin
                                        >set TCL_LIBRARY=d:\win32app\unison\lib
                                        >CALL D:\Development\dms_ver40\dms_batch\batch_standard\TPMS_Open.exe
                                        >
                                        >The bat file used to begin with the first DEL command, now it fails there.
                                        >The wrapped line (COPY) is one single line in the bat file. So, there are a
                                        >total of 10 lines.
                                        >Thanks,
                                        >Gary Ausdahl
                                        >(480) 754-6793
                                        >Ausdahl@... <mailto:Ausdahl@...>
                                        >
                                        >               -----Original Message-----
                                        >               From:   Michael Marquart [mailto:micm@...]
                                        >               Sent:   Thursday, November 01, 2001 11:32 AM
                                        >               To:     batchworld@yahoogroups.com
                                        >               Subject:        Re: [BATCH WORLD] Date concatenated into
                                        >file name for backup
                                        >
                                        >
                                        >
                                        >               I'm not an NT bod, but I'd say it's the delimiter you're
                                        >using in the for in
                                        >               do - it's a space.  try Ken's sample a few message back for
                                        >a different slant
                                        >               on it, or use / as a delimiter and add another token or so.
                                        >
                                        >               Michael
                                        >
                                        >               On Thu, 1 Nov 2001 11:29:16 -0700, "Ausdahl, Gary"
                                        ><ausdahl@...>
                                        >               wrote:
                                        >
                                        >               >Bingo - right again. Any idea why that would be there?
                                        >               >Thanks again...
                                        >               >
                                        >               >Gary Ausdahl
                                        >               >(480) 754-6793
                                        >               >Ausdahl@... <mailto:Ausdahl@...>
                                        >               >
                                        >               >               -----Original Message-----
                                        >               >               From:   Michael Marquart
                                        >[mailto:micm@...]
                                        >               >               Sent:   Thursday, November 01, 2001 11:24 AM
                                        >               >               To:     batchworld@yahoogroups.com
                                        >               >               Subject:        Re: [BATCH WORLD] Date
                                        >concatenated into
                                        >               >file name for backup
                                        >               >
                                        >               >
                                        >               >               try
                                        >               >
                                        >               >               echo "%date%"
                                        >               >
                                        >               >               and see what it shows.
                                        >               >
                                        >               >
                                        >               >               On Thu, 1 Nov 2001 11:18:14 -0700, "Ausdahl,
                                        >Gary"
                                        >               ><ausdahl@...>
                                        >               >               wrote:
                                        >               >
                                        >               >               >That would make sense, but the display
                                        >doesn't seem to show
                                        >               >it. I wonder if
                                        >               >               >it is at the end; but why would there be a
                                        >space in an
                                        >               >envvar? Below is the
                                        >               >               >entire bat file. Pretty simple actually:
                                        >               >               >@ECHO OFF
                                        >               >               >FOR /F "TOKENS=1* DELIMS= " %%A IN
                                        >('DATE/T') DO SET
                                        >               >DATE=%%B
                                        >               >               >REM Remove '/' from date
                                        >               >               >SET DATE=%DATE:/=%
                                        >               >               >ECHO It's %DATE% today
                                        >               >               >COPY OutputFiles\GLOUTPUT.txt
                                        >               >"OutputFiles\gl_backup\gl%date%.txt"
                                        >               >               >
                                        >               >               >Gary Ausdahl
                                        >               >               >(480) 754-6793
                                        >               >               >Ausdahl@...
                                        ><mailto:Ausdahl@...>
                                        >               >               >
                                        >               >               >               -----Original Message-----
                                        >               >               >               From:   Michael Marquart
                                        >               >[mailto:micm@...]
                                        >               >               >               Sent:   Thursday, November
                                        >01, 2001 11:10 AM
                                        >               >               >               To:
                                        >batchworld@yahoogroups.com
                                        >               >               >               Subject:        Re: [BATCH
                                        >WORLD] Date
                                        >               >concatenated into
                                        >               >               >file name for backup
                                        >               >               >
                                        >               >               >
                                        >               >               >               If you want to persue it, my
                                        >money is on the
                                        >               >contents of the
                                        >               >               >date environment
                                        >               >               >               variable.  It "must" contain
                                        >an odd
                                        >               >character. a %,;:/\=|+
                                        >               >               >etc
                                        >               >               >
                                        >               >               >
                                        >               >               >               Michael
                                        >               >               >
                                        >               >               >               On Thu, 1 Nov 2001 10:41:00
                                        >-0700, "Ausdahl,
                                        >               >Gary"
                                        >               >               ><ausdahl@...>
                                        >               >               >               wrote:
                                        >               >               >
                                        >               >               >               >Well, I don't understand
                                        >it. I see no
                                        >               >spaces or unusual
                                        >               >               >characters (except
                                        >               >               >               >for the space between
                                        >source and target).
                                        >               >This is the line
                                        >               >               >that does not
                                        >               >               >               >work (incorrect syntax):
                                        >               >               >               >COPY
                                        >OutputFiles\GLOUTPUT.txt
                                        >               >               >OutputFiles\gl_backup\gl%date%.txt
                                        >               >               >               >
                                        >               >               >               >This is the line that does
                                        >work:
                                        >               >               >               >COPY
                                        >OutputFiles\GLOUTPUT.txt
                                        >               >               >"OutputFiles\gl_backup\gl%date%.txt"
                                        >               >               >               >
                                        >               >               >               >The only difference is the
                                        >double quotes
                                        >               >around the target.
                                        >               >               >I'm just glad it
                                        >               >               >               >works.
                                        >               >               >               >Thanks,
                                        >               >               >               >Gary Ausdahl
                                        >               >
                                        >               >
                                        >               >               To Post a message, send it to:
                                        >batchworld@...
                                        >               >
                                        >               >               To Unsubscribe, send a blank message to:
                                        >               >batchworld-unsubscribe@...
                                        >               >
                                        >               >               Your use of Yahoo! Groups is subject to
                                        >               >http://docs.yahoo.com/info/terms/
                                        >               >              
                                        >
                                        >
                                        >               To Post a message, send it to:   batchworld@...
                                        >
                                        >               To Unsubscribe, send a blank message to:
                                        >batchworld-unsubscribe@...
                                        >
                                        >               Your use of Yahoo! Groups is subject to
                                        >http://docs.yahoo.com/info/terms/
                                        >              


                                        To Post a message, send it to:   batchworld@...

                                        To Unsubscribe, send a blank message to: batchworld-unsubscribe@...

                                        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                                  Your message has been successfully submitted and would be delivered to recipients shortly.