查找文件夹下特定文件并且打包,当文件名有空格,问题有意思了:
touch "a b c .txt"
find ./ -name "*.txt" | sed 's/\ /\\\ /g' | xargs tar -cvf haha.tar
通过类似system调用,进一步更改
system("find ./ -name "*.txt" | sed 's/\\ /\\\\\\ /g' | xargs tar -cvf haha.tar");
查找文件夹下特定文件并且打包,当文件名有空格,问题有意思了:
touch "a b c .txt"
find ./ -name "*.txt" | sed 's/\ /\\\ /g' | xargs tar -cvf haha.tar
system("find ./ -name "*.txt" | sed 's/\\ /\\\\\\ /g' | xargs tar -cvf haha.tar");