for i in {2..6}; do mv disc$i/* disc1; rm -rf disc$i; done - Need help making this work
Nils Kassube
kassube at gmx.net
Sun Jul 15 06:20:20 UTC 2012
Nathaniel Homier wrote:
> This gives error of > @saturn:~/cng$ for i in {2..6}; do mv disc$i/*
> disc1; rm -rf disc$i; done
I wouldn't include the rm command before I know that the first part of
the command works ...
> > mv: cannot move `disc2/images' to `disc1/images': File exists
> > mv: cannot move `disc3/images' to `disc1/images': File exists
> > mv: cannot move `disc4/images' to `disc1/images': File exists
> > mv: cannot move `disc5/images' to `disc1/images': File exists
> > mv: cannot move `disc6/images' to `disc1/images': File exists
>
> What I'm trying to do is merge 6 dir's into 1. The dir structure is
> - disc1/images/
>
> The top level dir are the same it's the files that are unique. I
> want to put the files in the same dir, disc 1, disc1/images/
>
> for i in {2..6}; do mv disc$i/* disc1;
Try "mv disc$i/images/* disc1/images/" instead.
Nils
More information about the ubuntu-users
mailing list