print all files of a directory

At the moment I do not know anything UNIX script :rolleyes:
but i need to make script that prints the content of the archives

(of text) that are deposited in a directory and Later erases these

archives, leaving the directory emptiness

It would be like repository for print

please help me

thanks

monica

you may use cat command to print contents of text files, once they are extracted from the archived file.

use rm command to delete files once you are done with printing

MYDIR=/home/sri
cd $MYDIR
ls -1 $MYDIR | lp  # list all the file in sri directory and print those file by lp command

use this simple code ..still you want more help
pls give full details with simple example....

Thanks Yogesh and thanks srikanthus too.

i think that will use the option "ls -1 $MYDIR | lp "

another question....
If i want to automatice How i do?
May be very interesante every 5 minutes print the contens of the directoy , (and this script must be resident) How i do ?

Thanks again

monica

PD: excuseme but my english is not too good

save this script, chmod 755, and put a line in the cron file to execute the script at desired time; call it directly like : /home/user/script. ot the respective location.

thanks sysgate ....!

well
i`m working in the idea but i dont have de unix here(i am at home it is for the work)

I need opinions about this

Work? :confused: :rolleyes:

MYDIR=/usr/xgf/mislib/ftp2prn

cd $MYDIR

ls -l > /usr/tmpA
cantarch = `wc -l /usr/tmpA`

if ($cantarch > 0) then
ls -1 $MYDIR | lp
ls -1 $MYDIR | rm
rm tmpA
else
rm /usr/tmpA
endif

Regards

Monica

I understood that you want to execute this script automatically.
for this you will have to enter in crontab file...

pls dig up this link , you must get the useful info ...
Try this cron and crontab

thanks
srikanth

srikanth, you understood fine !

i am thinking about this and if i want to execute this script automatically every 5 minutes need put a crontab like this

*/5 * * * * /usr/bin/bash/dfpe5m.sh

it is fine?
need your opinion, thanks !!! :wink:

regards

monica

The syntax */5 isn't supported by all Unix flavors.
An alternative is to specify explicitly the values:

0,5,10,15,10,25,30,35,40,45,50,55 * * * * /usr/bin/bash/dfpe5m.sh

Jean-Pierre.

thanks aigles!!!

is very important your opinion for me, because i don`t know anything about UNIX script .... i am a beginer and the boos dont�t giveme opinions

thanks

regards

monica