Re: Stupid shell question

2012-02-15 Thread Chrissy Jackson
On 12/02/12 23:55, Joel Roth wrote: Hi Shellsters, I've got a directory structure like this: ./project1/bak/a.yml ./project1/bak/b.yml ./project2/bak/c.yml ./project2/bak/d.yml I want to move the *.yml files into the corresponding parent directory. I tried this: for dir in `find -maxdepth

Re: Stupid shell question

2012-02-13 Thread Joel Roth
On Mon, Feb 13, 2012 at 09:50:08AM +, Chris Davies wrote: > Joel Roth wrote: > > ./project1/bak/a.yml > > ./project1/bak/b.yml > > ./project2/bak/c.yml > > ./project2/bak/d.yml > > > I want to move the *.yml files into the corresponding parent directory. > > rename 's!(.*/)([^/]*)$!$1../$2!'

Re: Stupid shell question

2012-02-13 Thread Chris Davies
Joel Roth wrote: > ./project1/bak/a.yml > ./project1/bak/b.yml > ./project2/bak/c.yml > ./project2/bak/d.yml > I want to move the *.yml files into the corresponding parent directory. rename 's!(.*/)([^/]*)$!$1../$2!' project*/bak/*.yml ;-) Chris -- To UNSUBSCRIBE, email to debian-user-requ..

Re: Stupid shell question

2012-02-13 Thread Joel Roth
On Mon, Feb 13, 2012 at 10:12:14AM +0200, Andrei Popescu wrote: > On Du, 12 feb 12, 20:01:05, Joel Roth wrote: > > > > > > for dir in `find -maxdepth 1 -type d`; do chdir $dir/bak; mv *.yml > > > ../..; done > > > > Thanks, I got something like that to work. > > I would have tried something w

Re: Stupid shell question

2012-02-13 Thread Andrei Popescu
On Du, 12 feb 12, 20:01:05, Joel Roth wrote: > > > > for dir in `find -maxdepth 1 -type d`; do chdir $dir/bak; mv *.yml ../..; > > done > > Thanks, I got something like that to work. I would have tried something with find's '-execdir' - no need to operate on find's output (not a good idea un

Re: Stupid shell question

2012-02-12 Thread Joel Roth
On Mon, Feb 13, 2012 at 01:44:21AM +, ACro wrote: > > > for dir in `find -maxdepth 1 -type d`; do chdir $dir/bak; mv *.yml .. ; > > chdir > > ../..; done > > > Joel, > > try this, HTH: > > for dir in `find -maxdepth 1 -type d`; do chdir $dir/bak; mv *.yml ../..; > done Thanks, I got s

Re: Stupid shell question

2012-02-12 Thread ACro
> for dir in `find -maxdepth 1 -type d`; do chdir $dir/bak; mv *.yml .. ; chdir > ../..; done Joel, try this, HTH: for dir in `find -maxdepth 1 -type d`; do chdir $dir/bak; mv *.yml ../..; done Kind regards, Andrew -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a