Skip to content

Instantly share code, notes, and snippets.

@hkskoglund
Created December 20, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkskoglund/af5adb82df36ecf6d1d0cd233e267bd3 to your computer and use it in GitHub Desktop.
Save hkskoglund/af5adb82df36ecf6d1d0cd233e267bd3 to your computer and use it in GitHub Desktop.
Get root folderstring DCS-936L camera
curl --anyauth -u admin: 'http://192.168.0.110/eng/admin/adv_sdcard.cgi?folderpath=&command=video' -s -e 'http://192.168.0.110/eng/admin/adv_sdcard.cgi?folderpath=20171220&command=video&filesperpage=100' | grep folderstring | cut -d ">" -f 2 | cut -d "<" -f 1
@hkskoglund
Copy link
Author

curl --anyauth -u admin: 'http://192.168.0.110/eng/admin/adv_sdcard.cgi?folderpath=20171220/12&command=video&filesperpage=100' -s -e 'http://192.168.0.110/eng/admin/adv_sdcard.cgi?folderpath=20171220&command=video&filesperpage=100' | grep folderstring | cut -d ">" -f 2 | cut -d "<" -f 1 | tr -cd "*" | wc -c
Get number of files

@hkskoglund
Copy link
Author

<config> <playback> <recordEnable>1</recordEnable> <status>2</status> <strSDStatus>Ready</strSDStatus> <performance>100</performance> <targetType>0</targetType> <totalcapacity>31154688</totalcapacity> <availablespace>3853984</availablespace> <usedspace>27300704</usedspace> <modelUsedSpace>0</modelUsedSpace> <folderstring>20171220:d:-1*20171219:d:-1*20171218:d:-1*20171217:d:-1*20171216:d:-1*20171215:d:-1*20171214:d:-1*20171213:d:-1*20171212:d:-1*20171211:d:-1*20171210:d:-1*20171209:d:-1*20171208:d:-1*20171207:d:-1*20171206:d:-1*20171205:d:-1*20171204:d:-1*20171203:d:-1*20171202:d:-1*20171201:d:-1*20171130:d:-1*20171129:d:-1*20171128:d:-1*20171127:d:-1*20171126:d:-1*20171125:d:-1*20171124:d:-1*20171123:d:-1*20171122:d:-1*20171121:d:-1*20171120:d:-1*20171119:d:-1*20171118:d:-1*20171117:d:-1*20171116:d:-1*20171115:d:-1*20171114:d:-1*20171113:d:-1*20171112:d:-1*20171111:d:-1*20171110:d:-1*20171109:d:-1*20171108:d:-1*20171107:d:-1*20171106:d:-1*20171105:d:-1*20171104:d:-1*20171103:d:-1*20171102:d:-1*20171101:d:-1*20171031:d:-1*20171030:d:-1*20171029:d:-1*20171028:d:-1*20171027:d:-1*20171026:d:-1*20171025:d:-1*20171024:d:-1*20171023:d:-1*20171022:d:-1*20171021:d:-1*20171020:d:-1*20171019:d:-1*20171018:d:-1*20171017:d:-1*20171016:d:-1*20171015:d:-1*20171014:d:-1*20171013:d:-1*20171012:d:-1*20171011:d:-1*20171010:d:-1*20171006:d:-1*20160101:d:-1*</folderstring> <filesperpage>100</filesperpage> <currentpage>1</currentpage> <totalpages>1</totalpages> </playback> </config>

@hkskoglund
Copy link
Author

hkskoglund commented Dec 20, 2017

config=$(curl --anyauth -u admin: 'http://192.168.0.110/eng/admin/adv_sdcard.cgi?folderpath=&command=video&filesperpage=100' -s -e 'http://192.168.0.110/')

@hkskoglund
Copy link
Author

folderstring=$(echo $config | tr ' ' '\n' | grep folderstring | cut -d ">" -f 2 | cut -d "<" -f 1)

@hkskoglund
Copy link
Author

totalpages=$(echo $config | tr ' ' '\n' | grep totalpages | cut -d ">" -f 2 | cut -d "<" -f 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment