Question: ```
<?php

    $sub="test";
    $msg="testing mail code";
    $to1="a......k@gmail.com"; //my active gmail id..i can receive mail here with same code.
    $to2="xyz@abc.com";//i set this invalid id dont get mail with same code because id not existed.

    $to=$to1.','.$to2;

    if(mail($to, $sub, $msg))
    {
        ?>
            <script >
                alert('Message Sent..!!!!');
            </script>
        <?php
    }
    else
    {
        ?>
            <script >
                alert('Oooooooop...... Message not Sent..!!!!');
            </script>
        <?php
    }

    ?>  

```

In this given code i having 2 email ids first one is valid and active and another one is guessed id that is not valid and not exist any where .now when i m sending mail with this code it shows me message like message sent..!!!. i know that second email id is wrong so second id cant get that mail,so how i can alert when some ids like second id. which cant get id or which ids are not valid.

Answer: 
You can use the command `ls -l | grep ^-`

Here is full list options for `ls` command.

```
Option  Description
-a  Displays all files.
-b  Displays nonprinting characters in octal.
-c  Displays files by file timestamp.
-C  Displays files in a columnar format (default)
-d  Displays only directories.
-f  Interprets each name as a directory, not a file.
-F  Flags filenames.
-g  Displays the long format listing, but exclude the owner name.
-i  Displays the inode for each file.
-l  Displays the long format listing.
-L  Displays the file or directory referenced by a symbolic link.
-m  Displays the names as a comma-separated list.
-n  Displays the long format listing, with GID and UID numbers.
-o  Displays the long format listing, but excludes group name.
-p  Displays directories with /
-q  Displays all nonprinting characters as ?
-r  Displays files in reverse order.
-R  Displays subdirectories as well.
-t  Displays newest files first. (based on timestamp)
-u  Displays files by the file access time.
-x  Displays files as rows across the screen.
-1  Displays each entry on a line.

```
If you've `sed` binary in your Android device, then do:

```
ls -l | sed '/^d/ d' 

```

It will delete all lines starting with `d` from the output of `ls -l` ([Source](https://stackoverflow.com/questions/8206280/delete-all-lines-beginning-with-a-from-a-file)). Why? Because all directories in the output starts with `d` so remove them and you'll get only the file names.

If you don't have the `sed` in Android, then you can `adb pull` the file into PC (saved output of `ls -l`), and process it with (would work only for Linux PC):

```
cat <YOUR_FILE> | sed '/^d/ d' 

```