10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I Want to remove all the sub-directories except latest five in any given TGTDIR.
Is there a way to do so without making a cd to TGTDIR?
I have tried the following but not worked.
Thank you.
rm -rf `ls -t $TGTDIR | awk 'NR>5'` (20 Replies)
Discussion started by: Devendra Hupri
20 Replies
2. Shell Programming and Scripting
hi,
i have some file in a directory say
p1.txt.201305051200.lst
p1.txt.201305051300.lst
p1.txt.201306051200.lst
p1.txt.201306051300.lst
p2.txt.201306051200.lst
p2.txt.201306051300.lst
i am using p* pattern to retrieve these file
ls -1 p*
the files in red color are the latest... (7 Replies)
Discussion started by: Little
7 Replies
3. Shell Programming and Scripting
How do I write a bash or ruby or perl or groovy script to print all the files in my directory tree that are one-to-two years old, the size of each file, and the sum of file sizes and then delete them?
I was using
find . -atime +365 -exec rm '{}' \;
but the problem was that I could not... (5 Replies)
Discussion started by: siegfried
5 Replies
4. Shell Programming and Scripting
I Need help for one requirement,
I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix.
Example:
Source Directory : \a
destination Directory : \a\b
File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt)
File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies
5. Shell Programming and Scripting
hi
I have a directory structure like
Parent
Parent/child1/
Parent/child2/
Parent/child3/ and the each main directory contains
Parent/child1/file1.txt, Parent/child1/fil2.zip .......
Parent/child2/file1.txt,Parent/child/fil2.zip ......
Now i want to traverse to each and want to... (1 Reply)
Discussion started by: Reddy482
1 Replies
6. Shell Programming and Scripting
Hi Team,
I wish to copy the latest file of pattern "MyFile*" to some other location.
I need to do all the operation in a single command separated by |.
ls -rt <MyFile*> | tail -1 | <copy command>.
How can I do?
Please help me.
Thanks,
Kanda (2 Replies)
Discussion started by: spkandy
2 Replies
7. Shell Programming and Scripting
Hi All,
I am in the directory a/b/processed
the files in this directories are
-rw-r--r-- 1 owb users 330 Aug 8 chandantest.txt_08082008
-rw-r--r-- 1 owb users 220 Aug 7 chandantest.txt_07082008
-rw-r--r-- 1 owb users 330 Aug 6... (3 Replies)
Discussion started by: chandancsc
3 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I have some list of directories in the form datemonthyear e.g. 02082009, 03082009 and 04082009 etc.
I need to pick the latest directory from the current working directory.
Outcome:
05082009
This is the output am expecting.
Thanks (6 Replies)
Discussion started by: venkatesht
6 Replies
9. Shell Programming and Scripting
hi,
I need to get the latest directory created for example wheni run
ls -altr *xyz_Integration*
I have plenty of directories created like
my_build_77_xx_Integration_050908_150714:
total 177898
-rw-rw--- 1 xyzmgr cchyg 7687338 May 9 19:29 myapp.ear
... (2 Replies)
Discussion started by: f354676
2 Replies
10. Shell Programming and Scripting
Hi,
I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub directory in source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (1 Reply)
Discussion started by: srmadab
1 Replies