Re: What's the easiest way to move some files in a directory tree?
Martin Dickopp <martin-deb@zero-based.org> writes:
> U N T E S T E D :
> -----------------
>
> find olddir -type d | while read d; do mkdir "`echo \"$d\" | sed s,^olddir,newdir,`"; done
> find olddir -type f -name \*.mp3 | while read f; do mv "$f" "`echo \"$f\" | sed s,^olddir,newdir,`"; done
I think my shell-scripting foo disagrees with yours. I'd do something
like this (also untested):
cd /old/directory/root
mkdir /new/directory/root
ln -s /new/directory/root new
find . -type d -exec mkdir new/{} \;
find . -type f -name '*.ogg' -exec cp {} new/{} \;
rm new
If /new/directory/root is something short (like /mnt), you could just
as easily skip the symlink step.
--
David Maze dmaze@debian.org http://people.debian.org/~dmaze/
"Theoretical politics is interesting. Politicking should be illegal."
-- Abra Mitchell
Reply to: