Discussion:
Using blat to send the last modified NTbackup log
(too old to reply)
beyondusualband
2008-08-27 12:52:42 UTC
Permalink
I have been using blat for sometime and it works great. How can I tell
Blat the send the last modified file from the NTbackup log? NTbackup
creates 10 log files, backup01.log backup02.log and so on, how do I
tell blat to look for the newest backup log file and send that one, or
is there a better way to do this all together?

Thanks!

Adam
North Florida Technology Solutions
Belorit, Jeff
2008-08-27 14:05:09 UTC
Permalink
Here is one way to do what you're asking. I use an older version of
forfiles.exe (win 2000 days) I think the switches are different in the
newer version. It just calls a batch file passing the log file name as
an argument that runs blat.

@echo off
rem
************************************************************************
*************
rem *** Check for latest Backup log
***
rem
************************************************************************
*************
c:
cd\"Documents and Settings\username\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data"
c:\batch\forfiles -m*.log -d+0 -c"CMD /c call c:\batch\sendlog.bat
@FILE"

________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
beyondusualband
Sent: Wednesday, August 27, 2008 8:53 AM
To: ***@yahoogroups.com
Subject: [blat] Using blat to send the last modified NTbackup log



I have been using blat for sometime and it works great. How can I tell
Blat the send the last modified file from the NTbackup log? NTbackup
creates 10 log files, backup01.log backup02.log and so on, how do I
tell blat to look for the newest backup log file and send that one, or
is there a better way to do this all together?

Thanks!

Adam
North Florida Technology Solutions






+++ This email and related attachments may contain confidential information intended exclusively for the addressee. Unauthorized use, disclosure or distribution of this material is prohibited. If you received this message in error, please advise the sender and delete all copies of it. Content is provided by the individual sender and does not necessarily reflect the views of the Company. Though sender believes this transmission to be virus-free, it is the recipient's responsibility to ensure that it is.




[Non-text portions of this message have been removed]
Tim Musson
2008-08-27 14:35:10 UTC
Permalink
Hey beyondusualband,

On Wednesday, August 27, 2008 at 8:52:42 AM you wrote

b> I have been using blat for sometime and it works great. How can I
b> tell Blat the send the last modified file from the NTbackup log?
b> NTbackup creates 10 log files, backup01.log backup02.log and so on,
b> how do I tell blat to look for the newest backup log file and send
b> that one, or is there a better way to do this all together?

That is a batch file question, not Blat. I suggest you Google your
question. You could also search this lists archives. There may be an
answer there.

You are probably looking for how to use the FOR command.
--
Tim Musson
Flying with The Bat! eMail v3.99.29
The trouble with life is there's no background music.
Blat Manager, current version is 2.6.2, see www.blat.net
Adam Henderson
2008-08-27 15:12:36 UTC
Permalink
Maybe I dont understand what I am doing as much as I thought I did. what I
have now will send the batch file I tell it to send, but I want to be able
to tell it to look for the last modified or newest file and send that log.
Is that making sense?


-----Original Message-----
From: ***@yahoogroups.com [mailto:***@yahoogroups.com]On Behalf Of Tim
Musson
Sent: Wednesday, August 27, 2008 10:35 AM
To: beyondusualband
Subject: Re: [blat] Using blat to send the last modified NTbackup log


Hey beyondusualband,

On Wednesday, August 27, 2008 at 8:52:42 AM you wrote

b> I have been using blat for sometime and it works great. How can I
b> tell Blat the send the last modified file from the NTbackup log?
b> NTbackup creates 10 log files, backup01.log backup02.log and so on,
b> how do I tell blat to look for the newest backup log file and send
b> that one, or is there a better way to do this all together?

That is a batch file question, not Blat. I suggest you Google your
question. You could also search this lists archives. There may be an
answer there.

You are probably looking for how to use the FOR command.

--
Tim Musson
Flying with The Bat! eMail v3.99.29
The trouble with life is there's no background music.
Blat Manager, current version is 2.6.2, see www.blat.net






[Non-text portions of this message have been removed]
Michael Leone
2008-08-27 15:22:35 UTC
Permalink
Post by Adam Henderson
Maybe I dont understand what I am doing as much as I thought I did. what I
have now will send the batch file I tell it to send, but I want to be able
to tell it to look for the last modified or newest file and send that log.
Is that making sense?
It does. But that selection process (to determine the newest file) is
not something that blat does. But you can probably do that in a
Windows batch file (it is Windows, right?). What version?

The FOR command can be used to process a set of files, so you should
be able to do something like:

FOR /F %%G IN ('dir /b /O:-D *.log') DO
Send using BLAT (%%G is your filename to send)
Break out of loop (since you only want the newest file) by doing GOTO
)

See: <http://www.ss64.com/nt/for_cmd.html> for hints.
Post by Adam Henderson
-----Original Message-----
Musson
Sent: Wednesday, August 27, 2008 10:35 AM
To: beyondusualband
Subject: Re: [blat] Using blat to send the last modified NTbackup log
Hey beyondusualband,
b> I have been using blat for sometime and it works great. How can I
b> tell Blat the send the last modified file from the NTbackup log?
b> NTbackup creates 10 log files, backup01.log backup02.log and so on,
b> how do I tell blat to look for the newest backup log file and send
b> that one, or is there a better way to do this all together?
That is a batch file question, not Blat. I suggest you Google your
question. You could also search this lists archives. There may be an
answer there.
You are probably looking for how to use the FOR command.
--
Tim Musson
Flying with The Bat! eMail v3.99.29
The trouble with life is there's no background music.
Blat Manager, current version is 2.6.2, see www.blat.net
[Non-text portions of this message have been removed]
--
Michael J. Leone, <mailto:***@mike-leone.com>

PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>

"Sometimes your lack of sympathy gets hard to explain,
So on your mask of make-up you just paint a little parody of pain"
"When You Were Young", Del Amitri
jasonclamb
2008-08-27 15:47:12 UTC
Permalink
I have a batch file that uses NTBackup to backup our QuickBooks DB,
it then sends the log to me. It looks for a BKS file with the same
name in the same directory as the batch file.

1 ::Backup.cmd
2 IF EXIST "%~dpn0.bkf" DEL "%~dpn0.bkf"
3 ntbackup backup "@%~dpn0.bks" /j "QuickBooks Backup" /f "%
~dpn0.bkf" /D "%DATE% %TIME%" /FU /R:yes /L:f /RS:yes /M normal
4
5 FOR /F "usebackq" %%i IN (`dir "%USERPROFILE%\Local
Settings\Application Data\Microsoft\Windows
NT\NTBackup\data\*.log" /o:d /b`) DO SET LOG=%%i
6 COPY "%USERPROFILE%\Local Settings\Application
Data\Microsoft\Windows NT\NTBackup\data\%LOG%" "%~dpn0.log" /y
7
8 "C:\Program Files\Blat\blat.exe" "%~dpn0.log" -to
Post by Michael Leone
Post by Adam Henderson
Maybe I dont understand what I am doing as much as I thought I did. what I
have now will send the batch file I tell it to send, but I want to be able
to tell it to look for the last modified or newest file and send that log.
Is that making sense?
It does. But that selection process (to determine the newest file) is
not something that blat does. But you can probably do that in a
Windows batch file (it is Windows, right?). What version?
The FOR command can be used to process a set of files, so you should
FOR /F %%G IN ('dir /b /O:-D *.log') DO
Send using BLAT (%%G is your filename to send)
Break out of loop (since you only want the newest file) by
doing GOTO
Post by Michael Leone
)
See: <http://www.ss64.com/nt/for_cmd.html> for hints.
Post by Adam Henderson
-----Original Message-----
Musson
Sent: Wednesday, August 27, 2008 10:35 AM
To: beyondusualband
Subject: Re: [blat] Using blat to send the last modified NTbackup log
Hey beyondusualband,
b> I have been using blat for sometime and it works great. How can I
b> tell Blat the send the last modified file from the NTbackup log?
b> NTbackup creates 10 log files, backup01.log backup02.log and so on,
b> how do I tell blat to look for the newest backup log file and send
b> that one, or is there a better way to do this all together?
That is a batch file question, not Blat. I suggest you Google your
question. You could also search this lists archives. There may be an
answer there.
You are probably looking for how to use the FOR command.
--
Tim Musson
Flying with The Bat! eMail v3.99.29
The trouble with life is there's no background music.
Blat Manager, current version is 2.6.2, see www.blat.net
[Non-text portions of this message have been removed]
--
PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>
"Sometimes your lack of sympathy gets hard to explain,
So on your mask of make-up you just paint a little parody of pain"
"When You Were Young", Del Amitri
Tim Musson
2008-08-27 16:21:04 UTC
Permalink
Thanks Jason!,

Adam,
Here is the Batch file to play with (works on XP).
To simplify Jason's a bit and add a bit of explanation...

for /f %%i in ('dir backup??.log /o:-d /b') do (
blat -to ***@example.net -attach %%i
goto END
)
:END

"for" is a batch command that iterates through lists - in this case
the output of the dir command in the first ().
"/f" changes the behavior of the FOR command (use for /? for help)
"%%i" is the variable the FOR command will use.
"in" part of the FOR commands syntax
1st () Contains the list to process
The '' chars with the /f switch make the FOR command use the output of
the command inside the ''s.
"dir" lists files
"backup??.log" is a way of telling the DIR command to list all files
that have backup as the first part, anything for the
next 2 characters, and ending with ".log".
"/o:-d" changes how the DIR command lists files. Basically it is
listing them newest first (get help with dir /?)
"/b" tells the DIR command to only display filenames
"do" is the next part of the FOR command
2nd () this is what gets processed for each item matched in the first
set of () and put in the %%i variable.
"blat" this of course is the Blat command sending the file in the %%i
Variable
"goto END" is how we make sure that Blat is only asked to send the
first mile matched by the DIR command.
":END" is where the GOTO command goes in the processing of the batch
file...
--
Tim Musson
Flying with The Bat! eMail v3.99.29
I don't suffer from insanity; I enjoy every minute of it.
Blat Manager, current version is 2.6.2, see www.blat.net
Adam Henderson
2008-08-27 17:13:35 UTC
Permalink
Tim and Jason that really helps, thanks alot!

I am getting an error messege thats says
C:\ (file path) \backup??.log was unexpected at this time

what am I doing wrong. I have tried to save the .bat file in the directory
of the backup log and I get the same error.


-----Original Message-----
From: ***@yahoogroups.com [mailto:***@yahoogroups.com]On Behalf Of Tim
Musson
Sent: Wednesday, August 27, 2008 12:21 PM
To: jasonclamb
Subject: Re: [blat] Re: Using blat to send the last modified NTbackup log


Thanks Jason!,

Adam,
Here is the Batch file to play with (works on XP).
To simplify Jason's a bit and add a bit of explanation...

for /f %%i in ('dir backup??.log /o:-d /b') do (
blat -to ***@example.net -attach %%i
goto END
)
:END

"for" is a batch command that iterates through lists - in this case
the output of the dir command in the first ().
"/f" changes the behavior of the FOR command (use for /? for help)
"%%i" is the variable the FOR command will use.
"in" part of the FOR commands syntax
1st () Contains the list to process
The '' chars with the /f switch make the FOR command use the output of
the command inside the ''s.
"dir" lists files
"backup??.log" is a way of telling the DIR command to list all files
that have backup as the first part, anything for the
next 2 characters, and ending with ".log".
"/o:-d" changes how the DIR command lists files. Basically it is
listing them newest first (get help with dir /?)
"/b" tells the DIR command to only display filenames
"do" is the next part of the FOR command
2nd () this is what gets processed for each item matched in the first
set of () and put in the %%i variable.
"blat" this of course is the Blat command sending the file in the %%i
Variable
"goto END" is how we make sure that Blat is only asked to send the
first mile matched by the DIR command.
":END" is where the GOTO command goes in the processing of the batch
file...

--
Tim Musson
Flying with The Bat! eMail v3.99.29
I don't suffer from insanity; I enjoy every minute of it.
Blat Manager, current version is 2.6.2, see www.blat.net






[Non-text portions of this message have been removed]
Tim Musson
2008-08-27 17:18:58 UTC
Permalink
Hey Adam,

On Wednesday, August 27, 2008 at 1:13:35 PM you wrote

AH> I am getting an error messege thats says
AH> C:\ (file path) \backup??.log was unexpected at this time

AH> what am I doing wrong. I have tried to save the .bat file in the directory
AH> of the backup log and I get the same error.

Not enough info to answer.

What does your batch file look like (cut/paste please).
--
Tim Musson
Flying with The Bat! eMail v3.99.29
"Upgrade: take old bugs out, put new ones in."
Blat Manager, current version is 2.6.2, see www.blat.net
jasonclamb
2008-08-27 18:17:44 UTC
Permalink
post your batch file...
also you might want to try changing -attach %%i to -attach "%%i"
this will be necessary if your path contains spaces.
Post by Adam Henderson
Tim and Jason that really helps, thanks alot!
I am getting an error messege thats says
C:\ (file path) \backup??.log was unexpected at this time
what am I doing wrong. I have tried to save the .bat file in the directory
of the backup log and I get the same error.
-----Original Message-----
Musson
Sent: Wednesday, August 27, 2008 12:21 PM
To: jasonclamb
Subject: Re: [blat] Re: Using blat to send the last modified
NTbackup log
Post by Adam Henderson
Thanks Jason!,
Adam,
Here is the Batch file to play with (works on XP).
To simplify Jason's a bit and add a bit of explanation...
for /f %%i in ('dir backup??.log /o:-d /b') do (
goto END
)
:END
"for" is a batch command that iterates through lists - in this case
the output of the dir command in the first ().
"/f" changes the behavior of the FOR command (use for /? for help)
"%%i" is the variable the FOR command will use.
"in" part of the FOR commands syntax
1st () Contains the list to process
The '' chars with the /f switch make the FOR command use the
output of
Post by Adam Henderson
the command inside the ''s.
"dir" lists files
"backup??.log" is a way of telling the DIR command to list all files
that have backup as the first part, anything for the
next 2 characters, and ending with ".log".
"/o:-d" changes how the DIR command lists files. Basically it is
listing them newest first (get help with dir /?)
"/b" tells the DIR command to only display filenames
"do" is the next part of the FOR command
2nd () this is what gets processed for each item matched in the first
set of () and put in the %%i variable.
"blat" this of course is the Blat command sending the file in the %%i
Variable
"goto END" is how we make sure that Blat is only asked to send the
first mile matched by the DIR command.
":END" is where the GOTO command goes in the processing of the batch
file...
--
Tim Musson
Flying with The Bat! eMail v3.99.29
I don't suffer from insanity; I enjoy every minute of it.
Blat Manager, current version is 2.6.2, see www.blat.net
[Non-text portions of this message have been removed]
Adam Henderson
2008-08-27 18:43:53 UTC
Permalink
this is the batch file I am working with now
for /f %%i in C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\backup??.log
/o:-d /b' do
blat -to ***@nftechnology.com -attach %%i
goto END
:END

that batch file is saved in the blat directory.

this batch file I have used before to send single files and it works no
problem

c:
cd \
cd Blat250\full\

Blat -body "Backup Logs." -s "[backup] Important files" -to
***@nftechnology.com -af files-to-backup.txt

with "files-to-backup" being a txt file of the files I want to send.

-----Original Message-----
From: ***@yahoogroups.com [mailto:***@yahoogroups.com]On Behalf Of
jasonclamb
Sent: Wednesday, August 27, 2008 2:18 PM
To: ***@yahoogroups.com
Subject: [blat] Re: Using blat to send the last modified NTbackup log


post your batch file...
also you might want to try changing -attach %%i to -attach "%%i"
this will be necessary if your path contains spaces.
Post by Adam Henderson
Tim and Jason that really helps, thanks alot!
I am getting an error messege thats says
C:\ (file path) \backup??.log was unexpected at this time
what am I doing wrong. I have tried to save the .bat file in the directory
of the backup log and I get the same error.
-----Original Message-----
Musson
Sent: Wednesday, August 27, 2008 12:21 PM
To: jasonclamb
Subject: Re: [blat] Re: Using blat to send the last modified
NTbackup log
Post by Adam Henderson
Thanks Jason!,
Adam,
Here is the Batch file to play with (works on XP).
To simplify Jason's a bit and add a bit of explanation...
for /f %%i in ('dir backup??.log /o:-d /b') do (
goto END
)
:END
"for" is a batch command that iterates through lists - in this
case
Post by Adam Henderson
the output of the dir command in the first ().
"/f" changes the behavior of the FOR command (use for /? for help)
"%%i" is the variable the FOR command will use.
"in" part of the FOR commands syntax
1st () Contains the list to process
The '' chars with the /f switch make the FOR command use the
output of
Post by Adam Henderson
the command inside the ''s.
"dir" lists files
"backup??.log" is a way of telling the DIR command to list all
files
Post by Adam Henderson
that have backup as the first part, anything for the
next 2 characters, and ending with ".log".
"/o:-d" changes how the DIR command lists files. Basically it is
listing them newest first (get help with dir /?)
"/b" tells the DIR command to only display filenames
"do" is the next part of the FOR command
2nd () this is what gets processed for each item matched in the first
set of () and put in the %%i variable.
"blat" this of course is the Blat command sending the file in the %%i
Variable
"goto END" is how we make sure that Blat is only asked to send the
first mile matched by the DIR command.
":END" is where the GOTO command goes in the processing of the
batch
Post by Adam Henderson
file...
--
Tim Musson
Flying with The Bat! eMail v3.99.29
I don't suffer from insanity; I enjoy every minute of it.
Blat Manager, current version is 2.6.2, see www.blat.net
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Tim Musson
2008-08-27 19:27:51 UTC
Permalink
Hey Adam,

On Wednesday, August 27, 2008 at 2:43:53 PM you wrote

AH> this is the batch file I am working with now
AH> for /f %%i in C:\Documents and Settings\Administrator\Local
AH> Settings\Application Data\Microsoft\Windows NT\NTBackup\data\backup??.log
AH> /o:-d /b' do
AH> blat -to ***@nftechnology.com -attach %%i
AH> goto END
AH> :END

Ok, you removed some of the chars that are needed...

With that long a path, I would put the path in a var (not needed, but
I like my for statement to be easily readable...)

Try the following:

::\\\Note the below is one line///
set BUPath=C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\
::///Note the above is one line\\\
for /f %%i in ('dir %BUPath%\backup??.log /o:-d /b') do (
blat -to ***@nftechnology.com -attach "%%i"
::Note I wrapped %%i in " chars as Jason correctly suggested!
goto END
)
:END
--
Tim Musson
Flying with The Bat! eMail v3.99.29
Never be afraid to try something new. Remember, amateurs built the
ark. Professionals built the Titanic.
Blat Manager, current version is 2.6.2, see www.blat.net
Adam Henderson
2008-08-27 20:16:19 UTC
Permalink
Using

set BUPath=C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\

for /f %%i in ('dir %BUPath%\backup??.log /o:-d /b') do (blat -to
***@nftechnology.com -attach "%%i"goto END):END

I get a "system cannot find path specified" error msg at cmd prompt.

The above should be saved as a .bat file correct? does it need to be saved
in the same directory as the backup log or can i save it in the
C:\blat250\full\ dir

Adam
-----Original Message-----
From: ***@yahoogroups.com [mailto:***@yahoogroups.com]On Behalf Of Tim
Musson
Sent: Wednesday, August 27, 2008 3:28 PM
To: Adam Henderson
Subject: Re: [blat] Re: Using blat to send the last modified NTbackup log


Hey Adam,

On Wednesday, August 27, 2008 at 2:43:53 PM you wrote

AH> this is the batch file I am working with now
AH> for /f %%i in C:\Documents and Settings\Administrator\Local
AH> Settings\Application Data\Microsoft\Windows
NT\NTBackup\data\backup??.log
AH> /o:-d /b' do
AH> blat -to ***@nftechnology.com -attach %%i
AH> goto END
AH> :END

Ok, you removed some of the chars that are needed...

With that long a path, I would put the path in a var (not needed, but
I like my for statement to be easily readable...)

Try the following:

::\\\Note the below is one line///
set BUPath=C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\
::///Note the above is one line\\\
for /f %%i in ('dir %BUPath%\backup??.log /o:-d /b') do (
blat -to ***@nftechnology.com -attach "%%i"
::Note I wrapped %%i in " chars as Jason correctly suggested!
goto END
)
:END

--
Tim Musson
Flying with The Bat! eMail v3.99.29
Never be afraid to try something new. Remember, amateurs built the
ark. Professionals built the Titanic.
Blat Manager, current version is 2.6.2, see www.blat.net






[Non-text portions of this message have been removed]
namtog
2008-08-27 21:50:54 UTC
Permalink
Greetings,

Adam wrote;
set BUPath=C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\

Adam as was mentioned in a earlier post by Michael Leone
you need to put in "parens and quotes." Read back for his post.

I mainly wanted to thank all of you who have contributed
to this thread. I haven't had to write a batch script in
some time.My skills weren't much to begin with but they
were starting to fade.

This is like a refresher course with out the mucho dinero
$$$$$ bill to pay.

You guys are the best.
Namtog
Michael Leone
2008-08-27 19:29:27 UTC
Permalink
Post by Adam Henderson
this is the batch file I am working with now
for /f %%i in C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\Windows NT\NTBackup\data\backup??.log
/o:-d /b' do
You need parens and quotes:

It's much easier to change directory first:

SETLOCAL ENABLEDEYALEDEXPANSION
CD "C:\Documents and Settings\Administrator\LocalSettings\Application
Data\Microsoft\Windows NT\NTBackup\data"
SET DIRCMD=/b /o:-d
for /f %%i in ( "dir backup??.log')do
Post by Adam Henderson
goto END
:END
--
Michael J. Leone, <mailto:***@mike-leone.com>

PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>

"Sometimes your lack of sympathy gets hard to explain,
So on your mask of make-up you just paint a little parody of pain"
"When You Were Young", Del Amitri
Tim Musson
2008-08-28 12:16:34 UTC
Permalink
Hey Michael,

On Wednesday, August 27, 2008 at 3:29:27 PM you wrote

ML> It's much easier to change directory first:

True, and if I were actually writing the batch file instead of helping
someone else, that is what I would have done... LOL

ML> SETLOCAL ENABLEDEYALEDEXPANSION

Had never used those commands either. I googled them and they look
really useful! Will probably use them in the future. tks!

ML> CD "C:\Documents and Settings\Administrator\LocalSettings\Application
ML> Data\Microsoft\Windows NT\NTBackup\data"
ML> SET DIRCMD=/b /o:-d

That %dircmd% is one I always forget! makes the following much easier
to read! thanks again.

ML> for /f %%i in ( "dir backup??.log')do
--
Tim Musson
Flying with The Bat! eMail v3.99.29
I try to take one day at a time, but sometimes several days attack me
at once.
Blat Manager, current version is 2.6.2, see www.blat.net
Michael Leone
2008-08-28 13:18:52 UTC
Permalink
Post by Tim Musson
Hey Michael,
True, and if I were actually writing the batch file instead of helping
someone else, that is what I would have done... LOL
Oh, I know. :-) I was trying for hints, for anyone reading the thread.
Didn't mean to write the whole thing for him. Not for free, anyhow ...
:-)
Post by Tim Musson
ML> SETLOCAL ENABLEDEYALEDEXPANSION
Had never used those commands either. I googled them and they look
really useful! Will probably use them in the future. tks!
np. It does help tremendously. I've been writing a lot of Windows
shell scripts recently. While it can be limiting, it can still
surprise you. Things like subroutines ...
--
Michael J. Leone, <mailto:***@mike-leone.com>

PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>

"Sometimes your lack of sympathy gets hard to explain,
So on your mask of make-up you just paint a little parody of pain"
"When You Were Young", Del Amitri
jasonclamb
2008-08-28 13:27:51 UTC
Permalink
Just a small point... if you are going to CD first you should use
the /D parameter. If your current working directory happens to be a
different drive, you will get unexpected results. In this NTBackup/e-
mail script you won't get the log, but this example would be a little
harder to recover from:

C:
CD \
CD D:\Temp
RD . /s/q
Post by Michael Leone
Post by Adam Henderson
this is the batch file I am working with now
for /f %%i in C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\Windows
NT\NTBackup\data\backup??.log
Post by Michael Leone
Post by Adam Henderson
/o:-d /b' do
SETLOCAL ENABLEDEYALEDEXPANSION
CD "C:\Documents and
Settings\Administrator\LocalSettings\Application
Post by Michael Leone
Data\Microsoft\Windows NT\NTBackup\data"
SET DIRCMD=/b /o:-d
for /f %%i in ( "dir backup??.log')do
Post by Adam Henderson
goto END
:END
--
PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>
"Sometimes your lack of sympathy gets hard to explain,
So on your mask of make-up you just paint a little parody of pain"
"When You Were Young", Del Amitri
Tim Musson
2008-08-27 15:38:19 UTC
Permalink
Hey Adam,

On Wednesday, August 27, 2008 at 11:12:36 AM you wrote

AH> Maybe I dont understand what I am doing as much as I thought I did. what I
AH> have now will send the batch file I tell it to send, but I want to be able
AH> to tell it to look for the last modified or newest file and send that log.
AH> Is that making sense?

Yep, and you would probably use the Batch FOR command for that.

Logically it would go something like this;
FOR %%i IN (backup??.log) DO (
send with Blat the most recent file
)

So, you would use Batch file commands to figure out which file you
actually want to send. THEN have Blat send that file.

Blat has no way to pick the file for you...
--
Tim Musson
Flying with The Bat! eMail v3.99.29
I'm planning to be spontaneous tomorrow.
Blat Manager, current version is 2.6.2, see www.blat.net
Loading...