「Argument list too long」をどうにかする
ファイルの数が多い時に「mv * /path/to/destination/dir/」と打つと「Argument list too long」と怒られてしまったりする.
そういう時は:
find . -maxdepth 1 -name "your_wildcard" -exec mv {} /path/to/destination/dir \;
while readと関数で:
Example 3b
function larger_mv () { while read line1; do md5sum directory/$line1 >> ~/md5sums ls -l directory/$line1 >> ~/backup_list mv directory/$line1 ../directory2 done } ls -1 directory/ | larger_mv
もしくはkernelを弄る…:
/* * MAX_ARG_PAGES defines the number of pages allocated for arguments * and envelope for the new program. 32 should suffice, this gives * a maximum env+arg of 128kB w/4KB pages! */ #define MAX_ARG_PAGES 32