Posts in the scripting caterory

Other categories: calendar configuration dev diagnostics easter-eggs frontend fullstack hardware internet optimisation programming scripting servers software sysadmin terminal vue web

Batch rename extensions

Another snippet, this time to batch rename the extension of a set of files to another, in my case I needed to rename *.html files as .mustache so, as before, (when I set up a scripts folder in my user folder and added it …

Find in files script

Similar to the previous post, I can never remember the correct format for grepping recursively through folders for a particular string. So I added the following script to a file called findinfiles in the scripts …

Find files script

I can never remember the correct format of the find command so that I can recusively search through folders for a particular file or files. So I set up a scripts folder in my user folder and added it to my path in my …

Automatic backup of mysql database to S3

Most of my websites run on Amazon’s EC2 servers and in setting up a new one today I thought I had better come up with a better backup strategy. In the past I’ve just asked EC2 to create either AMI or EBS …

Using PHP DomDocument to remove nodes

I needed to strip out some DOM nodes from a HTML file. I would use SED but some of the tags are multiline, and SED/regexes really don’t understand HTML/XML and get really confused if you’re using nested tags …

The wonder of xargs

If you’re ever sat at the linux commandline and had a repetitive task to complete on some files or directories then you’ll find “xargs” together with “find” a very useful combination. …

Find and replace in multiple files

Just had to make a few changes to a website I own that means changing the same text in lots of files. Linux has lots of powerful tools to enable you to make this kind of change over lots of files over many directories …

Trash rather than rm

One of the most powerful/dangerous commands in linux is the “rm” command.  It removes the file from the filesystem and whilst with some media formats it is possible to recover an rm’d file in ext3 it is …