Moving Only Sub-Directories?
Jason White
jason at jasonjgw.net
Fri May 7 08:13:38 UTC 2010
>From the root of the tree where the subdirectories are:
for f in * ; do
if [ -d $f ] ; then
mv $f /some/new/location
fi
done
Note that moving a directory also moves its entire contents, including
all subdirectories.
Note also is that the above lines are what you would type at the shell
to effect the desired result; this is an example of how interactive
shell sessions can turn imperceptibly into programming. The next step
after that is to save such material in files, at which point you're
starting to write shell scripts.
I tested it out by substituting echo for mv and making sure that it
identified exactly what I wanted.
More information about the Blinux-list
mailing list