Re: Moving Only Sub-Directories?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>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.

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list

[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]