Skip to content

Instantly share code, notes, and snippets.

View mishmam3's full-sized avatar

Mahdir Ishmam mishmam3

  • ThousandEyes
View GitHub Profile
@tegansnyder
tegansnyder / hdfs_file_cleanup_cron.sh
Created October 17, 2017 20:34
HDFS cron to delete old files in directory
#!/bin/bash
now=$(date +%s);
days_to_keep=5
# Loop through files
hdfs dfs -ls /some_hdfs_directory | while read f; do
# Get File Date and File Name
file_date=`echo $f | awk '{print $6}'`;
file_name=`echo $f | awk '{print $8}'`;