find | xargs

Today cron doesn't want to regexp my "cp [a-Z]* ...". Even if i set SHELL=/bin/bash in the crontab it got the error "cp: cannont stat [a-Z]*: No such file or directory". Manually on the shell there is no problem with regexp (it's locales fault; cron uses the POSIX locale and here I should use [a-zA-Z] as regexp). So I tried find in combination with xargs:

find /dir -print0 -type f | xargs cp -t /target/dir

The commandline switch -t makes it easier to use xargs with cp and even mv.

Comments (0)

2013-03-26 09:24:53