Skip to content

Commit d7bbe25

Browse files
committed
nc-scan: improvements
1 parent e03b095 commit d7bbe25

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

bin/ncp/TOOLS/nc-scan.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,28 @@
1111

1212
install()
1313
{
14-
cat > /usr/local/bin/ncp-scan <<EOF
14+
cat > /usr/local/bin/ncp-scan <<'EOF'
1515
#!/bin/bash
16-
cd /var/www/nextcloud
17-
sudo -u www-data php occ files:scan --all
16+
ncc files:scan -n -v --all
1817
EOF
1918
chmod +x /usr/local/bin/ncp-scan
2019
}
2120

2221
configure()
2322
{
24-
/usr/local/bin/ncp-scan
23+
[[ "$RECURSIVE" == no ]] && local recursive=--shallow
24+
[[ "$NONEXTERNAL" == yes ]] && local non_external=--home-only
25+
26+
[[ "$PATH1" != "" ]] && \
27+
ncc files:scan -n -v $recursive $non_external -p "$PATH1"
28+
29+
[[ "$PATH2" != "" ]] && \
30+
ncc files:scan -n -v $recursive $non_external -p "$PATH2"
31+
32+
[[ "$PATH3" != "" ]] && \
33+
ncc files:scan -n -v $recursive $non_external -p "$PATH3"
34+
35+
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && ncc files:scan -n -v --all
2536
}
2637

2738
# License

etc/ncp-config.d/nc-scan.cfg

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,38 @@
33
"name": "Nc-scan",
44
"title": "nc-scan",
55
"description": "Scan NC for externally modified files",
6-
"info": "",
6+
"info": "Optionally we can specify up to 3 paths in the form '_user_/files/_path_'",
77
"infotitle": "",
8-
"params": []
8+
"params": [
9+
{
10+
"id": "RECURSIVE",
11+
"name": "Recursive",
12+
"value": "yes",
13+
"type": "bool"
14+
},
15+
{
16+
"id": "NONEXTERNAL",
17+
"name": "Ignore external files",
18+
"value": "no",
19+
"type": "bool"
20+
},
21+
{
22+
"id": "PATH1",
23+
"name": "Path",
24+
"value": "",
25+
"suggest": "/ncp/files/Documents"
26+
},
27+
{
28+
"id": "PATH2",
29+
"name": "Path",
30+
"value": "",
31+
"suggest": "/family/files/Photos"
32+
},
33+
{
34+
"id": "PATH3",
35+
"name": "Path",
36+
"value": "",
37+
"suggest": "/family/files/Videos"
38+
}
39+
]
940
}

0 commit comments

Comments
 (0)