Skip to content

Instantly share code, notes, and snippets.

@ohader
Last active March 13, 2018 12:13
Show Gist options
  • Save ohader/dd76710c1afdd5d28af7b3cf844e716a to your computer and use it in GitHub Desktop.
Save ohader/dd76710c1afdd5d28af7b3cf844e716a to your computer and use it in GitHub Desktop.
TYPO3 Core: Search for similar documentation *.rst files
#!/bin/bash
##############################################################################################
# searching for similar documentation *.rst files in e.g.
# typo3/sysext/core/Documentation/Changelog organized in
# different sub-directories
#
# @license MIT
# @author Oliver Hader <oliver@typo3.org>
##############################################################################################
###
# Usage:
# cd typo3/sysext/core/Documentation/Changelog
# ~/typo3-documentation-compare.sh
###
otherDirectoryExclude=""
fileExcludePattern="Index.rst"
for currentDirectory in $(find * -type d)
do
echo "* scanning $currentDirectory"
otherDirectoryExlude="! -wholename $currentDirectory $otherDirectoryExlude"
# `-I` to ignore, not available for unix `ls`
for currentFile in $(ls -1 -c $currentDirectory *.rst | grep -v $fileExcludePattern)
do
for otherDirectory in $(find * -type d $otherDirectoryExlude)
do
if [ -e $otherDirectory/$currentFile ]
then
echo " + $currentDirectory/$currentFile -> $otherDirectory/$currentFile"
fi
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment