Excerpt |
---|
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. |
...
cp
Code Block |
---|
ls dir1 | xargs -I {} cp {} dir2/ |
Add prefix as "nice -n10" as below if you do it in the server and want to keep working other process
Code Block |
---|
ls dir1 | nice -n10 xargs -I {} cp {} dir2/ |
mv
Below commands enables you to copy files to $target_dir with no restriction
...
Code Block |
---|
find . -name "*" -print0 | xargs -0 rm -r |
Code Block |
---|
find . -name "*" -delete |