dummie ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting dummie ksh
# 1  
Old 03-06-2007
Data dummie ksh

Please help me with a newbie ksh question:


I want a script in ksh (under Solaris 8 - SPARC) who runs a "ls -lR" command in some directory and it looks after all the files with the same date as the current one and/or created in the last 24 hours (or N hours).

The script should do:
- if no files with the same date were found display "no new files found..."
- otherwise display "new files found..." and also all the lines (only those lines from my "ls -lR" command)
and/or
the same for the files created in the last N hours.


I thought this is very easy but I encountered difficulties when I tried to avoid displaying files with the same day, month but not the same year...

BTW the part with "the same date" might be done in one line command?

Last edited by heartwork; 03-06-2007 at 09:29 PM..
# 2  
Old 03-06-2007
You could try this link to find files older than particular number of days. Instead, of 30 you could try 1 day old. or any number of days you want to.

or

You could try to find a particular date using date calcand then try this link
# 3  
Old 03-06-2007
Try this:

ls -l $(find . -type f -mtime -1)
# 4  
Old 03-06-2007
Quote:
Originally Posted by jacoden
Try this:

ls -l $(find . -type f -mtime -1)
This is not going to work where there are lots of files, you'll receive an argument list that is too long.

Try
Code:
$ find . -type f -mtime -1 -print0 | xargs -0 ls -l

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

I'm a dummie!

Hi I was installing 10.04. At 38 minutes remaining it froze and stayed that way for about 2 hours. I shut it down and now It's "frozen" for lack of a better term. ubuntu screen comes up, goes to black screen with blinking cursor. Anyone? Thanks! ---------- Post updated at 08:03 PM ----------... (1 Reply)
Discussion started by: martinnod
1 Replies

2. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

3. UNIX for Dummies Questions & Answers

Linux Dummie Here!

I know absolutely NOTHING about Unix but want to learn. How should I go about learning it? (1 Reply)
Discussion started by: Gosade
1 Replies

4. UNIX for Dummies Questions & Answers

true dummie calling

hi i think this will make me seem dummier than most, actually i don't even understand most of the posts in the dummie section... i have a project and i need to learn fortran programming, im working on a windows xp pc and so i have installed cygwin. and the cygwin site basically says learn unix so... (4 Replies)
Discussion started by: holyhive
4 Replies

5. Linux

dummie questions

im a copletely newbie... i havent installed linux yet, but i wanna quit windows cuz i dont get it anymore... anything is better than this :mad: ... anyway...: does linux runs all file extensions thats windows does? i mean, .doc, .exe, .bat, .psp, etc? i reallly dunno how it works... normal... (3 Replies)
Discussion started by: guare_skt
3 Replies

6. UNIX for Dummies Questions & Answers

Dummie question on ping (loopback)

what's the point of having loopback when you can just ping your local ip address? for example if my ip is 1.1.1.1, why can't i just do ping 5 1.1.1.1 instead of ping 5 127.0.1.1? it seems to me the only point in having it is for the sake of convenience? (2 Replies)
Discussion started by: jinduy
2 Replies

7. UNIX for Dummies Questions & Answers

Dummie: How do I get variables mid program

I'm writing a simple program in unix and was wondering how mid switch I can run a program and get someone to enter variables for it i.e.: #!/bin/csh -f echo "If you wish to do v press v" echo "If you wish to compile press c" echo "If you wish to add an entry press a" echo "If you wish to... (1 Reply)
Discussion started by: RichardB
1 Replies

8. UNIX for Dummies Questions & Answers

Dummie Please Help With Unix And Win Xp

Please help : I have a question i am just starting to study UNIX and i need some advice,as my teacher isn,t the helpful type. I have just formatted my pc and partitioned it with win98 and winxp, do i need to create a partion for UNIX ??? OR is UNIX run in whatever partion i want it ???? Will... (6 Replies)
Discussion started by: DAFFYY30
6 Replies

9. UNIX for Dummies Questions & Answers

Dummie Question, Can anyone take a screen shot of a UNIX system?

Since i have never seen one of these systems, i am just curious of how it looks. Btw if unix is not a GUI then is it possible to take a screenshots (4 Replies)
Discussion started by: Punk18
4 Replies

10. UNIX for Dummies Questions & Answers

Please help this Dummie

I am trying to integrate a Digital Unix Alpha server in a LAN that contains several NT severs. Could someone give me some advise on how to integrate Alpha server, so I can contact the Alpha from any NT and visa versa. Thanks! (1 Reply)
Discussion started by: Rmeyvogel
1 Replies
Login or Register to Ask a Question