![]() |
|
|
|
|
|||||||
| 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 |
| Recursive FTP -- here at last. | Perderabo | Shell Programming and Scripting | 48 | 09-08-2008 07:56 AM |
| Recursive pid script | jbarnhar | Shell Programming and Scripting | 3 | 05-02-2007 12:14 PM |
| recursive wc on a directory? | bimba17 | UNIX for Dummies Questions & Answers | 1 | 11-29-2006 01:05 PM |
| recursive sorting | fermisoft | UNIX for Advanced & Expert Users | 1 | 08-16-2005 05:46 AM |
| recursive rcp | Nicol | Shell Programming and Scripting | 6 | 11-06-2003 07:52 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
I am trying to write a recursive FTP script and have come to a point where I need to test if the file is either a normal ascii file or a directory. My question is how do I test if the file is either ascii or directory.
|
| Forum Sponsor | ||
|
|
|
|||
|
use test
example: Perform a mkdir if a directory does not exist: test ! -d tempdir && mkdir tempdir for i in * do if test -d "$i" Directory processing commands...... fi done it is commonly used with if while do etc. in shell scripts. -r filename True if filename exists and is readable -w filename True if filename exists and is writable -x filename True if filename exists and is executable -f filename True if filename exists and is a regular file -d filename True if filename exists and is a directory -h filename True if filename exists and is a symbolic link. ........... test commands returns a status of 0(true) or 1 (false) depending on the evaluation of the conditional expression, which can be unary or binary. there is a long list of expression available; check the man page for more info |
|||
| Google The UNIX and Linux Forums |