<commit_before>#!/bin/bash

# Recursive File Compression Script
# Author: <NAME> <<EMAIL>>
# License: This script is public domain
# Date: 2014-03-17

# Description: This script will take a directory as an argument.
# It will then transverse the directory, and all sub directories,
# and compress the regular files in those directories with bzip2.
# The script just ignores any files that are not either a regular
# file or a directory (symbolic links, devices, etc).

BZIP2=/bin/bzip2
CLVL="-9"

# Test for a server list file argument
if [ -z "$1" ]; then
echo "Usage: $0 <directory>";
exit
fi

# Make sure the directory is valid and readable
if [ ! -d "$1" ]; then
echo "Error: Argument does not appear to be a directory: $1."
exit
fi

# This is the fuction that does the actual compression and 
# directory transversal.
function compress_files
{
	for i in $( ls );
	do
		if [ -f $i ]; then
			$BZIP2 $CLVL $i
		elif [ -d $i ]; then
			cd $i
			compress_files
			cd ..
		fi
	done
}

# To start the script, we change the current working directory
# to the directory to compress then kick off the initial call 
# to the recursive compress_files function.
cd $1
compress_files<commit_msg>Recursive file compression script<commit_after>#!/bin/bash

# Recursive File Compression Script
# Author: <NAME> <<EMAIL>>
# License: This script is public domain
# Date: 2014-03-17

# Description: This script will take a directory as an argument.
# It will then transverse the directory, and all sub directories,
# and compress the regular files in those directories with bzip2.
# The script just ignores any files that are not either a regular
# file or a directory (symbolic links, devices, etc).

BZIP2=/bin/bzip2
CLVL="-9"

# Test for a server list file argument
if [ -z "$1" ]; then
echo "Usage: $0 <directory>";
exit
fi

# Make sure the directory is valid and readable
if [ ! -d "$1" ]; then
echo "Error: Argument does not appear to be a directory: $1."
exit
fi

# This is the function that does the actual compression and 
# directory transversal.
function compress_files
{
	for i in $( ls );
	do
		if [ -f $i ]; then
			$BZIP2 $CLVL $i
		elif [ -d $i ]; then
			cd $i
			compress_files
			cd ..
		fi
	done
}

# To start the script, we change the current working directory
# to the directory to compress then kick off the initial call 
# to the recursive compress_files function.
cd $1
compress_files
{'fraction_non_alphanumeric': 0.08768267223382047, 'fraction_numerical': 0.015031315240083507, 'mean_word_length': 3.6980392156862747, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6381308', 'n_tokens_mistral': 779, 'n_tokens_neox': 724, 'n_words': 352}