Here's a sample bash script that can be used to delete old recordings in Vicidial:
bash#!/bin/bash
# Set the path to the recordings directory
recordings_dir="/path/to/recordings"
# Set the number of days to keep recordings
days_to_keep=30
# Get the current date
current_date=$(date +%Y-%m-%d)
# Calculate the date to delete recordings from
delete_date=$(date -d "$current_date - $days_to_keep days" +%Y-%m-%d)
# Find and delete recordings older than the specified number of days
find "$recordings_dir" -type f -name "*.wav" -mtime +$days_to_keep -exec rm {} \;
# Print a message with the number of deleted recordings
deleted_count=$(find "$recordings_dir" -type f -name "*.wav" -mtime +$days_to_keep | wc -l)
echo "Deleted $deleted_count recordings older than $delete_date"
Make sure to replace "/path/to/recordings" with the actual path to your Vicidial recordings directory. Also, modify the "days_to_keep" variable to specify the number of days you want to keep the recordings.
Save the script to a file, for example, "delete_old_recordings.sh". Then, make the script executable by running the following command:
bashchmod +x delete_old_recordings.sh
You can then execute the script by running:
bash./delete_old_recordings.sh
This script will find all the .wav files in the specified directory that are older than the specified number of days and delete them. It will also display the number of deleted recordings.
No comments:
Post a Comment