Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell scripting

Status
Not open for further replies.

djessi

IS-IT--Management
Dec 29, 2006
93
CM
Hi all,
I would like to write a shell script to count (get the number at any time) the number of files stored by a permanent ftp in a directory, even if the files are suppressed. The count will start at midnight and stops
at 23:59 (one day) and I would like to get the number of
coming file at any time of the day.
I need help, please
Djessi
 
I'm not sure if I totally understand your question but something like
Code:
ls -a | wc -l
will give the count of files (including . and ..) in a directory.

Ceci n'est pas une signature
Columb Healy
 
Like Columb, working in the dark slightly, but his solution placed in a script and written to a daily log file using cron?

More details if more is required, please.

 
Thanks for answers,
In fact I would like to count the files as soon as they arrive in the directory because they are processed and
deleted or move somewhere else.
Regards
 
You need to turn on logging for ftpd, then you can analyze the logfile for the information you need.

Add the "-l" flag to ftpd in your inetd.conf, then add the following line to /etc/syslog.conf:

daemon.info /path/to/logfile

The file needs to exist (use touch) and you'll need to restart or at least "kill -1" syslogd.

HTH,

Rod

IBM Certified Advanced Technical Expert pSeries and AIX 5L
CompTIA Linux+
CompTIA Security+

Wish you could view posts with a fixed font? Got Firefox & Greasemonkey? Give yourself the option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top