🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
3 messages
3 total messages Started by Devin the Elephant Sun, 18 Apr 1993 22:13
TIN: save unread articles to a file
#3915
Author: Devin the Elephant
Date: Sun, 18 Apr 1993 22:13
8 lines
1061 bytes
One of the users we support wrote to me with this question:

"I'd like to know how to, for a given newsgroup, specify that all the
new posts are to be gathered up into a single file (straight ascii
ok), and then downloaded.  Thanks..."

It's not obvious to me from the tin man page how to do this.  Does
anyone have a suggestion?
Re: TIN: save unread articles to a file
#3916
Author: Derek Bell
Date: Mon, 19 Apr 1993 10:53
102 lines
3392 bytes
Devin the Elephant (devin@telerama.pgh.pa.us) wrote:
: One of the users we support wrote to me with this question:

: "I'd like to know how to, for a given newsgroup, specify that all the
: new posts are to be gathered up into a single file (straight ascii
: ok), and then downloaded.  Thanks..."

: It's not obvious to me from the tin man page how to do this.  Does
: anyone have a suggestion?

What you can do is use the -S option to save out all the messages.  This
creates a file for each post in a directory like the group name ie posts
for alt.sources would be in alt/sources in your News directory.  You can then
run the script below which copies any posts into the one file called
[groupname]_yymmdd - just the groupname with the date appended.

The script is actually two files called process and process.loop which is
called from within process.  OK its a bit messy but I only wrote it yesterday
and its my first go at writing a script longer than about 4 lines.  It may
be bugged - one problem is if messages run from about 995 to 1005 say,
1000-1005 are stored first as tin doesn't put a 0 before the 9.

file process

#!/bin/csh

set today = (`date '+%y%m%d'`)
setenv TODAY $today

#uncomment the following line if your tin directory is not in a standard
#place

#setenv TINDIR $HOME/.news

#change this line to alter where the files are put

setenv SAVEDIR $TINDIR/saved

#change this line if news items are stored somewhere else

setenv NEWSDIR $TINDIR/News

#create the save directory if it doesn't exist

if (! -e $SAVEDIR) then
	echo creating directory $SAVEDIR
	mkdir $SAVEDIR
else if (-f $SAVEDIR) then
	echo Error: $SAVEDIR exists and is not a directory
	exit (1)
endif

cd $NEWSDIR
set currdir=$cwd
foreach i (`/bin/ls .`)
	if (-d $currdir/$i) then
		echo changing into $i
		cd $i
		process.loop $i
		cd $currdir
	endif
end

file process.loop

#!/bin/csh

set thisfile = $SAVEDIR/$1_$TODAY
set currdir=$cwd
foreach i (`/bin/ls .`)
	if (! -d $currdir/$i) then
		if (! -e $thisfile) then
			echo creating $thisfile
			cp /dev/null $thisfile
		endif
		echo copying $i to $thisfile:t
		cat $i >> $thisfile
	else
		echo changing into $i
		cd $i
		process.loop $1.$i
		cd currdir
	endif
end



Hope these help

--
Derek.
=====================================================

INTERNET	dbell@mcs.dundee.ac.uk
JANET		dbell@uk.ac.dundee.mcs

"I've got this shocking pain right behind the eyes.
Have you considered amputation?"

       -- Vila and Avon  [Blakes7 - Redemption]

=====================================================
Re: TIN: save unread articles to a file
#3928
Author: Mike Peeler
Date: Tue, 20 Apr 1993 13:43
30 lines
2079 bytes
Devin the Elephant (devin@telerama.pgh.pa.us) wrote:

>> "I'd like to know how to, for a given newsgroup, specify that all the
>> new posts are to be gathered up into a single file (straight ascii
>> ok), and then downloaded.  Thanks..."

Derek Bell (dbell@clyde.mcs.dundee.ac.uk) wrote:

> What you can do is use the -S option to save out all the messages.  This
> creates a file for each post in a directory like the group name ie posts
> for alt.sources would be in alt/sources in your News directory.  You can then
> run the script below which copies any posts into the one file called
> [groupname]_yymmdd - just the groupname with the date appended.

I have nits on your script, but I'll spare you (unless you're interested).
Your design is thoughtful and it's a good first effort.

As often happens in Unix, there are easier ways.  Devin said ascii would
be ok, not required.  I use 'zip -mr zipfile *' for my downloads.  Moves
all files under the current directory (recursively) into zipfile.  You
could also walk the tree with ls -R or find.

When using tin -S, be sure to use -c to mark the articles as read.  That
saves all articles, all groups.  If you want to do one group at a time,
you can use an alternate newsrc with -f groupfile.  If you do it a lot,
updating your normal .newsrc can get messy, best to keep each group in
only one of your groupfiles.
-- 

-Z-
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads