Page 1 of 1

script delete files with subfolder

Posted: 15 Oct 2023, 01:33
by oscar1412
Hello, can someone help me, this NAS is connected by ftp to a camera recorder, and it would need the files to be deleted automatically through a script. :(

Re: script delete files with subfolder

Posted: 15 Oct 2023, 07:11
by Gremlin
I do this in Scheduled Tasks:

Code: Select all

find /Volume2/IPCAM/ -name P*.jpg -mtime +6 -print -delete
find /Volume2/IPCAM/ -name A*.jpg -mtime +120 -print -delete
find /Volume2/IPCAM/ -type d -empty -print -delete
find /Volume2/DVR/ -name *.storage -mtime +120 -print -delete
find /Volume2/DVR/ -type d -empty -print -delete
Find and delete different types of files (P* are regular pictures; A* are alarm generated in my system) and dvr recordings all at varying age (6 days; 120 days. Prints an output of all files deleted which is both logged and emailed to my admin account.

Re: script delete files with subfolder

Posted: 15 Oct 2023, 20:03
by oscar1412
In tos 4.2 and e tos 5 can I do this script? In tos 4.2 it is understood that it is done through ssh?

Re: script delete files with subfolder

Posted: 15 Oct 2023, 21:52
by Gremlin
I have never used TOS4, so I can't comment. If you have a method to run cron, you can run individual commands or a script. Of course, you cannot run the exact commands in the example You would have to modify them to suit your environment. And, naturally, it would help if you told people what your environment is. There are no clues in your original post and I gave up crystal gazing years ago. :P

Re: script delete files with subfolder

Posted: 30 Nov 2023, 22:39
by aschang
Hello How did you mount your FTP to acceede to Camera SD card ?

Re: script delete files with subfolder

Posted: 30 Nov 2023, 22:52
by Gremlin
Not sure I follow. FTP is FTP ;) FTP server opens a port(s) and you allocate appropriate space and permissions for that space. Your camera then communicates with the server port using ftp client built into the camera(s). My (cheap, chinese) cameras operate without an sd card but that limits me to only sending pictures to the server (NAS in this case). Video output requires the sd card to record video and then that can be sent to ftp server. (But I don't need the video output to the NAS as I already have Hybrid DVR recording everything.) I have been testing Surveillance Manager, but it is lacking some functions for me.