# Automate OCC Filescan

**URL:** <https://help.nextcloud.com/t/automate-occ-filescan/35282>\
**Category:** ℹ️ Support\
**Tags:** external\_storage\
**Created:** [August 18, 2018, 8:47pm UTC](https://help.nextcloud.com/t/automate-occ-filescan/35282 "2018-08-18T20:47:15Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![gas85](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gas85/32/7772_2.png) [@gas85](https://help.nextcloud.com/u/gas85)\
**Post date:** [September 13, 2018, 11:55am UTC](https://help.nextcloud.com/t/automate-occ-filescan/35282/15 "2018-09-13T11:55:27Z")

</div>

Try to run (under NC user):

```
php occ files_external:list

```

you should see something similar to this:

 ![image](https://help.nextcloud.com/uploads/default/original/2X/8/84273075445b1819d5e68a78b1e9580362a86f61.png)

This will output list of _all_ external shares. Check that it is not empty.

Then try to run and check the output (it should be list of `USERNAME/files/SHARENAME`):

```
php occ files_external:list | awk -F'|' '{print $8"/files"$3}'| tail -n +4 | head -n -1 | awk '{gsub(/ /, "", $0); print}'

```

 ![image](https://help.nextcloud.com/uploads/default/original/2X/9/95bd4489fcad38b8c1bd9b64d8452c47afce963d.png)

Then take one path (from the 1st table, or last adopted list) and run command to check what happens:

```
php occ files:scan --path="/USERNAME/files/Mount_Point"

```

Every thing must bus executed under your NC user. For Ubuntu I used `sudo -u www-data` command as `www-data` is my NC user. Hope it helps you in trouble shooting.

---

_[View the full topic](https://help.nextcloud.com/t/automate-occ-filescan/35282)._
