I have attempted to write a script that renames a list of directories in a folder. It is a bash script and I am only using awk to accomplish this task.
Current form:
[2015] Name of the album
Desired form:
Name of the album - [2015]
My script:
#! /usr/bin/env bash
for f in \[*; do
mv -t "$f" "$( awk -F '\] ' ' {print $2 " - " $1 "]"}' <<<"$f" )"
done
When I execute the above script, I get the following error:
mv: cannot stat 'In Dreams [EP] - [1963]': No such file or directory