![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| recursive wc on a directory? | bimba17 | UNIX for Dummies Questions & Answers | 13 | 06-21-2009 11:51 AM |
| Recursive FTP -- here at last. | Perderabo | Shell Programming and Scripting | 52 | 03-25-2009 12:15 PM |
| Recursive pid script | jbarnhar | Shell Programming and Scripting | 3 | 05-02-2007 03:14 PM |
| recursive sorting | fermisoft | UNIX for Advanced & Expert Users | 1 | 08-16-2005 08:46 AM |
| recursive rcp | Nicol | Shell Programming and Scripting | 6 | 11-06-2003 11:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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.
|
|
||||
|
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 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|