I have a Bash script that is well suited for simply renaming directories that match the criteria.
for name in *\[*\]\ -\ *; do
if [[ -d "$name" ]] && [[ ! -e "${name#* - }" ]]; then
mv "$name" "${name#* - }"
fi
done
Currently, if the directory is as follows:
user1 [files.sentfrom.com] - Directory-Subject
It renames the directory and only the directory looks like
Directory-Subject (this could have different type of text)
How to change script / search criteria for search
www.ibm.com - Directory-Subject
and rename the directory and only the directory to
Directory-Subject
source
share