I accidentally copied the folders in my Music directory to the parent michal directory. I want to delete these directories in one fell swoop.
Is there any way to make the following work? Or is there a better alternative?
/home/michal/Music $ find . -type d -maxdepth 1 -exec rm -r ../{} \;
Evidently the {} is not being substituted, because the above returns
rm: ../{}: No such file or directory
rm: ../{}: No such file or directory
rm: ../{}: No such file or directory
...
for f in */; do rm -r ../"$f" ; donefind(link tobusybox) is less robust than GNUfind, and doesn’t accept all the commands that GNUfindaccepts. … (Cont’d)-exec cmd {} \;works; it’s a question of whether-exec cmd ../{} \;works.