Hello Digital!
06 Feb 22 16:03, you wrote to me:
Re: New Files Announcements w/SBBS
By: Ray Quinn to Digital Man on Sun Feb 06 2022 01:05 pm
On a related note: (Probably not really Synchronet specific) Where
would I find the proper language to add to the script so as to not
create the message should there be no new files listed in the time
frame, in this case - 1 day? I don't wish to send out an empty
message with just the header, date, and footer.
https://www.geeksforgeeks.org/shell-script-to-measure-size-of-a-file/
You probably want to store the file size (using stat or wc) in a
script variable and then compare it to 0.
I should have mentioned that I have never really done any programming. A few .bat files over the years, and lately some BASH scripts. I recently watched your Youtube video where you created the email file java script "module". I may want to start looking into doing things similar, provided I have an idea worth scripting.
I say that to lead to this: I followed the link above and was able to figure out how to accomplish my task. I appreciate it more than you know.
Feel free to critique my work. Here is what I came up with:
$SBBSEXEC/jsexec filelist -all -hdr -i -ext -pad -new=1 > $filepath
# Checking for empty file and exiting. We don't want to send out empty messages.
size=$(wc --bytes < $filepath)
echo " $(date +%B-%d-%Y-%T) Today's new files list file is $size Bytes" >> $logfile
if [ $size == 0 ]
then echo " $(date +%B-%d-%Y-%T) No new files today." >> $logfile ; exit
else
then the cat command I posted earlier to post the announcements. Seems to be working.
Again, thanks!
73 de W6RAY Ray Quinn
--- GoldED+/W64-MSVC 1.1.5-b20180707
* Origin: Ham Radio operators do it with frequency! (1:214/23)
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net