Task Scheduler Auto Delete Folder X Days Old working but email notification doesn't show specifics

Currently reading
Task Scheduler Auto Delete Folder X Days Old working but email notification doesn't show specifics

2
0
NAS
DS220+
Operating system
  1. Windows
Mobile operating system
  1. Android
I am using the following code for task scheduler to auto delete FTP video recordings of surveillance cameras.

Code:
find /volume1/VideoCameraRecordings/ -type f -mtime +7 -delete
find /volume1/VideoCameraRecordings/ -depth -type d -exec rmdir {} \; 2>/dev/null

It works great however when the task runs I do not get a proper output of what was deleted in the email. This is what I get instead...

Code:
Task Scheduler has completed a scheduled task.

Task: Auto Delete 1 Week Old Files From VideoCameraRecordings Folder
Start time: Thu, 02 Dec 2021 03:00:01 GMT
Stop time: Thu, 02 Dec 2021 03:00:16 GMT
Current status: 0 (Normal)
Standard output/error:


From NASHomeServer

As you can see above the output is blank. If I run the task manually and look at the logged output with task scheduler it displays exactly what was deleted. But the email I receive doesn't. Am I missing something?

Thank you
 
Hi,

This code will delete oldest data or recently data?
I also want to delete oldest data to newest. Example:
I have 3 folder like:
2023-02-05
2023-02-06
2023-02-07
I want to delete 2023-02-05 tomorrow, like:
2023-02-06
2023-02-07
2023-02-08
Anyone knows this? Thank you.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Old thread notice: There have been no replies in this thread for quite some time. The last reply was on .
The content in this thread may no longer be relevant. It might be better to open a new thread instead.

Similar threads

I have a very similar script that runs every 15 mins. But I needed it to delay to around 1.5 minutes after...
Replies
3
Views
476
As I said in my first post, I tried running it as me, as admin and as root but there was no difference...
Replies
7
Views
3,174
Thanks for the quick relay. Now I understand what the "Last run time" means.
Replies
2
Views
632
  • Question
The cron jobs are listed in file /etc/crontab. Looking in the file you can see most jobs are handled by...
Replies
1
Views
5,272
Thanks, but I don't see how that helps. My DS218 devices do support Snapshot & Replication, but as near...
Replies
2
Views
1,869
Shellcheck bash "/volume1/Base/install reaspberrypi/scripts/Defrag dsm.sh"
Replies
1
Views
4,222
Then you dont have a root cert and if you skipped entering SAN values in the wizard, you will have to...
Replies
13
Views
3,297

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top