How do I ??


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do I ??
# 1  
Old 11-03-2008
How do I ??

1) Find file with latest creation date
2) FInd latest two files and send output to a file (I guess I can redirect the command to a file).

3) Find if the file has one or more records (BAsically > 0 Bytes)
# 2  
Old 11-04-2008
1. find / -mtime 1 | tail -1
2. find / -mtime 1 | tail -2 > file_name
3. I am not sure abt this
# 3  
Old 11-04-2008
If the files are in the same directory and there are no subdirectories. Finding the newest file on the whole computer is a different ball game.
1) ls -latr |grep -v \^drw | tail -1
2) ls -latr | grep -v \^drw | tail -2 > files.lst
3) find . -type f -size +0c -exec ls -lad {} \;
OR to check an individial file
if [ -s file_name ]
then
echo "File is not zero size"
fi
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question