Category Archives: Uncategorized

Clean up your files (Linux)

Today I wanted to clean up my computer a bit and decided to finally tackle my files.

Over time, I have accumulated duplicated files and empty folders and it was starting to irritate me to “think” I had saved something (because I saw the folder), only to realise the folder was empty (bad backup over the years, didn’t restore the files within it for example). So I decided to get rid of all duplicate files and empty folders. Here is how I did it :

Delete empty folders

find ~/ -type d -empty -delete

Find duplicate files

fdupes ~/ -r >> duplicate_files.txt or fdupes ~/ -r -d (to get prompted to delete the found files)

Hope this is useful to someone.

Joomla permissions fix script

As I’m doing quite some Joomla development, I wrote this small script that could be used for multiple purposes. It takes 1 parameter which is the directory of your joomla installation (I restrained it within the “/var/www/” directory, as a precaution, but you can get rid of this) and  then goes through folders and files to change their permissions. Hope it’s useful to someone :


#! /bin/bash
# This script simply fixes the permissions on a Joomla install to be perfectly $
# Need at least 1 parameter, which is the joomla root directory
MINPARAMS=1
DIRECTORYPARAM=$1

if [ ${DIRECTORYPARAM:0:9} == "/var/www/" ];
then
if [ $DIRECTORYPARAM == "/var/www/" ];
then
echo "The directory CANNOT be /var/www/ itself"
else
find $DIRECTORYPARAM -type d -exec chmod 755 {} ;
find $DIRECTORYPARAM -type f -exec chmod 644 {} ;
fi
else
echo "The directory can ONLY be in /var/www/"
fi