I'm cleaning up a CVS repo before migration to git. As part of the preparation I need to find (and possibly remove) any folders which ONLY contain an
My unix-fu is not strong, but here's what I attempted, which doesn't work, but hopefully conveys the intent.
shopt -s globstar for file in **/* do if [ -d "$file" ];then if [`ls | wc -l` == 1 && `ls Attic | wc -l` == 1]; then ((echo Attic-only folder)) fi fi done
The second part to this is to then find any folders (or folder chains, rather) that are empty.
For example, if
/foo/bar/Attic is removed, and
/foo/bar are now both empty, lets kill that part of the tree too.
Background: I'm trying to clean up a CVS repository for migration to git. CVS creates an
Attic folder for deleted files. Over the last 10 years some Bad Things have happened. I am fully aware of the risks and implications. I have backed up my data and I'm working on a copy.