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

Re: Stupid shell question

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 {} .. \;

Kind regards,
Offtopic discussions among Debian users and developers:

Attachment: signature.asc
Description: Digital signature

Reply to: