Category: Bash Scripting

Excluding .git Directories When Using diff -r

When comparing two directories with diff -r, you often don’t want to wade through Git’s internal metadata. By excluding .git directories, your diffs stay focused on meaningful changes. Here’s how to do it on Linux, macOS, and BSD with simple one-liners.

Read More »

Flattening a WordPress Uploads Directory with Bash

Managing WordPress media files can be messy — especially when your uploads directory grows into a maze of nested year/month folders. This guide shows you how to flatten your entire uploads tree into a single folder using a simple Bash script, while safely handling duplicate filenames with automatic versioning.

Read More »

Automating GitHub Actions Workflows with the gh CLI

  GitHub Actions is a powerful feature of GitHub that enables automation of software workflows directly in your repository. Whether you’re running tests, deploying code, or performing scheduled tasks, Actions can help streamline your DevOps process. But did you know you can trigger these workflows directly from the command line using the GitHub CLI (gh)? This opens the door to scripting, local automation, and rapid testing of manual workflows—all without leaving your terminal. In this post, we’ll walk through how to use the gh CLI to trigger a GitHub Actions workflow and pass inputs dynamically. What Is GitHub Actions? GitHub Actions is a CI/CD (Continuous Integration/Continuous Deployment) platform built into GitHub. It allows you to define workflows in YAML files located in your repository’s .github/workflows/ directory. Each workflow can respond to different triggers, such as: Push or pull request events Scheduled cron jobs Manual triggers via workflow_dispatch Workflows are composed

Read More »

Automating File Cleanup: Removing Old Files with a Bash Script

Managing server storage efficiently is crucial for maintaining performance and ensuring that unnecessary files do not take up valuable disk space. One effective way to keep your system clean is by automatically removing old files that are no longer needed. In this guide, we’ll explore how to use a Bash script to delete files matching a specific pattern that are older than 7 days. Why Automate File Cleanup? As servers run over time, they accumulate logs, temporary files, and other data that may not be necessary for long-term storage. Regularly cleaning up these files can help: Free up disk space Improve server performance Reduce backup sizes Ensure compliance with data retention policies Rather than manually deleting old files, an automated Bash script can handle the task efficiently. Writing a Bash Script for File Cleanup The following script finds and removes files that match a given pattern and are older than

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.