Shell 脚本文件复制检查器
Shell script file copy checker
我使用 find . -name \*.%ext% -print0 | xargs -I{} -0 cp -v {} %File%s
命令在 Drobo 上复制并重新排序了将近 1TB 的文件。我需要确保所有文件都正确复制。这是我目前所拥有的:
#!/bin/sh
find . -type f -exec basename {} \; > Filelist.txt
sort -o Filelist.txt Filelist.txt
uniq -c Filelist.txt Duplist.txt
我需要找到一种方法来获取每个文件的校验和,并确保所有文件都被复制。源文件夹与副本在同一目录下,排列如下:
_Stock
_Audio
_CG
_Images
_Source (the files in all other folders come from here)
_Videos
我正在研究 OSX。
#!/bin/sh
find . \( ! -regex '.*/\..*' \) -type f -exec shasum {} \; -exec basename {} \; | cut -c -40 | sed 'N;s/\n/ /' > Filelist.txt
sort -o Filelist.txt Filelist.txt
uniq -c Filelist.txt Duplist.txt
sort -o Duplist.txt Duplist.txt
regex
表达式删除隐藏文件,shasum
和 basename
参数在文本文件中创建两个单独的输出,因此我们 |到 cut
然后 sed
合并输出,以便 sort
和 uniq
命令可以解析它们。脚本很乱,但很好地完成了工作。
我使用 find . -name \*.%ext% -print0 | xargs -I{} -0 cp -v {} %File%s
命令在 Drobo 上复制并重新排序了将近 1TB 的文件。我需要确保所有文件都正确复制。这是我目前所拥有的:
#!/bin/sh
find . -type f -exec basename {} \; > Filelist.txt
sort -o Filelist.txt Filelist.txt
uniq -c Filelist.txt Duplist.txt
我需要找到一种方法来获取每个文件的校验和,并确保所有文件都被复制。源文件夹与副本在同一目录下,排列如下:
_Stock
_Audio
_CG
_Images
_Source (the files in all other folders come from here)
_Videos
我正在研究 OSX。
#!/bin/sh
find . \( ! -regex '.*/\..*' \) -type f -exec shasum {} \; -exec basename {} \; | cut -c -40 | sed 'N;s/\n/ /' > Filelist.txt
sort -o Filelist.txt Filelist.txt
uniq -c Filelist.txt Duplist.txt
sort -o Duplist.txt Duplist.txt
regex
表达式删除隐藏文件,shasum
和 basename
参数在文本文件中创建两个单独的输出,因此我们 |到 cut
然后 sed
合并输出,以便 sort
和 uniq
命令可以解析它们。脚本很乱,但很好地完成了工作。