06-21-2013
Exclude incomplete files in ls -rlt
Hi All,
I am bit puzzled with this requirement where I need to list the files in a directory. However, files are being continuously written to this folder through FTP. Hence I need to exclude the file which is being written at the time of listing the directory. I thought of using file time stamp. I can list files with timestamps 5 minutes before the time I run ls -lrt command. I believe time taken to ftp the file will not take more than 5 minutes based on my observation.
I am not sure how do I list file based on time. Any help on this is highly appreciated. If there is any other option, please let me know.
Thanks
Angshuman
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
Is there any way I can check a file for the linefeed character at the end of the file, and append one only if it is missing (ie. Incomplete last line)?
Need to do this because I need to write a script to process files FTP-ed over from various machines, which may or may not be... (1 Reply)
Discussion started by: ziyi
1 Replies
2. Shell Programming and Scripting
Hi folks,
I am using the join command to join two files on a common field as follows:
File1.txt
Adsorption|H01.181.529.047
Adult|M01.060.116
Children|M01.055
File2.txt
5|Adsorption|C0001674
7|Adult|C000001
6|Children|C00002
join -i -t "|" -a 2 -1 1 -2 2 File1.txt File2.txt
This... (7 Replies)
Discussion started by: s0460205
7 Replies
3. UNIX for Advanced & Expert Users
Hi,
I want to get the disk usage of a directory. But I want it to ignore a particular directory within it.
Lets say I want disk usage of all files/dirs within dir1 except those that are named .snapshot
Does du have the option of excluding a particular directory. (1 Reply)
Discussion started by: the_learner
1 Replies
4. Shell Programming and Scripting
On Solaris & AIX, suppose there is a directory 'dir'.
Log files of size approx 1MB are continuously being
deposited here by scp command. I have a script that scans
this dir every 5 mins and moves away the log files that
have been deposited so far.
How do I design my script so that I pick up... (6 Replies)
Discussion started by: sentak
6 Replies
5. Solaris
On Solaris, suppose there is a directory 'dir'.
Log files of size approx 1MB are continuously being
deposited here by scp command. I have a script that scans
this dir every 5 mins and moves away the log files that
have been deposited so far.
How do I design my script so that I pick up *only*... (6 Replies)
Discussion started by: sentak
6 Replies
6. UNIX for Dummies Questions & Answers
If I execute the command "ls -l /export/home/abcde/dev/proj/code/* | awk -F' ' '{print $9}' | cut -d'/' -f6-8" it will list all the files in /export/home/abcde/dev/proj/code/ directory as well as the files in subdirectories also
proj/code/test.sh
proj/code/test1.c
proj/code/unix... (8 Replies)
Discussion started by: shyjuezy
8 Replies
7. UNIX for Dummies Questions & Answers
Sorry for the odd title, but I couldn't think of an easy way to describe my issue.
Background
I have a home security system that continually sends (via FTP) 4 different still images to a directory on my personal website - cam0.jpg, cam1.jpg, etc. I've written an extremely basic html script to... (4 Replies)
Discussion started by: CinciJeff
4 Replies
8. Shell Programming and Scripting
I am new to Shell Scripting and need some help.
The following batch job has been failing for me due to the .nfsxxx files in use. I need to know how to modify the following script to exclude the .nfsxxx files so this batch job will not fail on me. I have done lots of googling and keep coming back... (2 Replies)
Discussion started by: kimberlyg2007
2 Replies
9. Shell Programming and Scripting
Hi,
I need to exlucde the files which are present in exclude.txt from a directory
exlcude.txt
AUZ.txt
AUZ.chk
NZ.txt
NZ.chk
tried with below code but not working
ls -ltr | grep -v `cat exclude.lst` (9 Replies)
Discussion started by: rohit_shinez
9 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
May i please know how do i ensure my split command would NOT generate incomplete output files like below, the last lines in each file is missing some columns or last line is complete.
split -b 50GB File File_
File_aa
|551|70210203|xxxxxxx|12/22/2010 20:44:58|11/01/2010... (1 Reply)
Discussion started by: Ariean
1 Replies
ftpshut(1M) System Administration Commands ftpshut(1M)
NAME
ftpshut - close down the FTP Servers at a given time
SYNOPSIS
ftpshut [-V] [-v] [-l min] [-d min] time [warning-message...]
DESCRIPTION
The ftpshut command provides an automated shutdown procedure that the superuser can use to notify FTP users when the FTP Server is shutting
down.
Ten minutes before shutdown, or immediately if the value of time is less than ten minutes, any new FTP Server connections will be disabled.
You may adjust the shutdown of new FTP Server connections by means of the -l option.
Five minutes before shutdown, or immediately if the value of time is less than five minutes, all current FTP connections will be discon-
nected. You may adjust the shutdown of current FTP connections by means of the -d option.
The ftpshut command creates shutdown message files that the FTP Server uses to determine when to shutdown. Separate shutdown message files
are created in the anonymous and virtual host FTP Server areas, in addition to the system wide shutdown message file. Once the shutdown
occurs, the server continues to refuse connections until the appropriate shutdown message file is removed. This normally is done by using
the ftprestart(1M) command. The location of the shutdown message file is specified by the shutdown capability in the ftpaccess file.
The following magic cookies are available:
%s The time system is going to shut down.
%r The time new connections will be denied.
%d The time current connections will be dropped.
%C The current working directory.
%E The maintainer's email address as defined in the ftpaccess file.
%F The free space in the partition of CWD, in kilobytes.
%L The local host name.
%M The maximum allowed number of users in this class.
%N The current number of users in this class.
%R The remote host name.
%T The local time (form Thu Nov 15 17:12:42 1990).
%U The username given at login time.
OPTIONS
The ftpshut command supports the following options:
-V Display program copyright and version information, then terminate.
-d min The time ahead of shutdown, in minutes, that existing connections will be disconnected upon completion of their current or next
(if idle) FTP request.
-l min The time ahead of shutdown, in minutes, that new connections will be refused.
-v Verbose. Output the pathname of the shutdown message files created.
OPERANDS
The ftpshut command supports the following operands:
time The time at which ftpshut will bring the FTP Servers down. time can have a value of now, which indicates an immedi-
ate shutdown. Alternatively, time can specify a future time in one of two formats: +number or HHMM. The first form
brings the FTP Server down in number minutes. The second brings the FTP Server down at the time of day indicated,
using a 24-hour clock format. When using the absolute time format, you can only specify times between now and
23:59.
warning-message The message to display that warns of the imminent shutdown. The warning-message will be formatted at 70 characters
wide. ftpshut knows the actual string length of the magic cookies. If no warning-message is supplied, the default
message "System shutdown at %s" is used.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
FILES
/etc/ftpd/ftpaccess
/etc/ftpd/ftpservers
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWftpu |
+-----------------------------+-----------------------------+
|Interface Stability |External |
+-----------------------------+-----------------------------+
SEE ALSO
in.ftpd(1M), ftprestart(1M), shutdown(1M), ftpaccess(4), ftpservers(4), attributes(5)
SunOS 5.10 1 May 2003 ftpshut(1M)