[plug] Mass moving files with a script

Ben Woods woodsb02 at gmail.com
Wed Dec 6 11:12:20 WST 2006


Thanks heaps for that!

It worked perfectly!

I had already spotted most of those problems in your first script in
my test run and had begun to fix them - but you saved me a fair bit of
time!

Cheers mate!

> >
> > Totally untested...
>
> And it showed :p
> Try the following
>
> #!/bin/bash
> NEW_ROOT="/tmp/new"
> for dir in *
>
>        do pushd $dir
>         for files in *
>                 do newdir=`echo $files | cut -d - -f 1`
>                 mkdir -p $NEW_ROOT/$newdir
>                 mv -i $files $NEW_ROOT/$newdir/
>         done
>         popd
>
> done

-- 
From: Benjamin Woods
woodsb02 at gmail.com
Registered Linux User #372573
Registered Ubuntu User #6395



More information about the plug mailing list