![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to get files with a specific extension | janavenki | Shell Programming and Scripting | 9 | 11-27-2007 05:56 PM |
| Feedback: Allow tar.gz extension for files | DukeNuke2 | Post Here to Contact Site Administrators and Moderators | 2 | 08-29-2007 10:22 AM |
| Removing the extension and FTP the files | pradkumar | Shell Programming and Scripting | 1 | 02-14-2007 11:01 AM |
| replace *.sqc files with *.sqC extension | rameshonline | Shell Programming and Scripting | 6 | 04-28-2004 09:27 AM |
| How to list files will no extension | Wing m. Cheng | UNIX for Dummies Questions & Answers | 5 | 02-21-2002 11:34 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to test for files with a particular extension.
Hi!!,
Is there any way on Ksh to test the files having a particular Extension? My program looks something like: for i in *$1* do if "$i" != files with ext of .Z then compress -f $i fi done Any suggestions??? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
compress script
you could replace the high lighted bit with
if ["$1" != *.Z] or replaced the entire script with find (directory name) ! -name *.Z -exec compress -f {} \; Note using the find command will compress any file that is not compress in the specified directory. make sure you specify the right directory and do not specify the root directory. for example to compress any file in /var/log directory the syntax will be find /var/log ! -name *.Z -exec compress -f {} \; warning: do no spacify the root directory, only use the find command for log directory |
|||
| Google The UNIX and Linux Forums |