Code Snippets

Bash Script That Deletes Directories Older Than X Days If Y Number Of Directories Exist

Earlier tonight I created a little script that will run in cron on a Linux server. The script counts the number of directories and files in a specific directory and if the count is above Y then it deletes directories and files older than X number of days. In the example script below the number of items (directories and files) that have to be located in the directory before the script to delete files older than a specific date is 10. If there are ten items then the script will delete items older than 90 days. Below the script is the entry made in a specific users cron on the Linux server.

Technology Insights

Use wget To Download All PDF Files Listed On A Web Page, wget All PDF Files In A Directory

Earlier tonight I was working on a project for a customer that wants to translate the Hebrew Interlinear Bible into English which obviously has been done many times before. This customer however has some translations that he wants to make for himself so I needed to find a Hebrew Interlinear Bible in text or PDF format. I was able to locate the Hebrew Interlinear Bible in PDF format however there was a separate PDF for each chapter in each book which numbers something like 930 different PDF’s. I was able to use the wget command described in detail below to download all of the PDF’s with a single command on my Windows 7 computer.