You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

The reason this occurs is because bash actually expands the asterisk to every matching file, producing a very long command line. There are some workarounds for cp, mv, rm by find, xargs, and etc.



mv

Below commands enables you to copy files to $target_dir with no restriction

echo {$tmpFolder}/* | xargs mv -t {$target_dir}


Add prefix as "nice -n10" as below if you do it in the server and want to keep working other process

echo {$tmpFolder}/* | nice -n10 xargs mv -t {$target_dir}


rm

Delete all the files including directories

find . -name "*" -print0 | xargs -0 rm -r
find . -name "*" -delete
  • No labels