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

Re: Stupid shell question



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 with find's '-execdir'
> 
> - no need to operate on find's output (not a good idea unless you are 
>   100% sure there are no "strange" filenames)
> - no need for the added complexity of the loop, chdir, etc.
> 
> Something like this should work (untested):
> 
> find -type f -name '*.yml' -execdir mv {} .. \;

Works fine.  Now I see how the -execdir command works.
(Tried before, but must have had some syntax error.)

Thanks for your help!

 
> Kind regards,
> Andrei
> -- 
> Offtopic discussions among Debian users and developers:
> http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic



-- 
Joel Roth


Reply to: