所以我使用这个 perl 脚本来备份我的音乐。它将搜索自上次备份以来添加到我的磁盘的新音乐。
当此命令运行时:
find ~/Music -type f -mtime -145 | xargs tar -cvf backup.tar
我得到如下输出:
tar: Removing leading `/' from member names
tar: /home/amonteiro/Music/UFOmammut/8: Cannot stat: No such file or directory
tar: (2017)/08: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
tar: PSYRCLE.ogg: Cannot stat: No such file or directory
tar: /home/amonteiro/Music/UFOmammut/8: Cannot stat: No such file or directory
tar: (2017)/01: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
tar: BABEL.ogg: Cannot stat: No such file or directory
tar: /home/amonteiro/Music/UFOmammut/8: Cannot stat: No such file or directory
tar: (2017)/03: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
tar: ZODIAC.ogg: Cannot stat: No such file or directory
tar: /home/amonteiro/Music/UFOmammut/8: Cannot stat: No such file or directory
tar: (2017)/02: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
tar: WARSHEEP.ogg: Cannot stat: No such file or directory
tar: /home/amonteiro/Music/UFOmammut/8: Cannot stat: No such file or directory
tar: (2017)/06: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
tar: CORE.ogg: Cannot stat: No such file or directory
tar: /home/amonteiro/Music/UFOmammut/8: Cannot stat: No such file or directory
tar: (2017)/04: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
我尝试了所有能找到的方法但仍没有成功。
有什么意见吗?请告诉我。
答案1
文件名中有空格,因此使用null char
:
find ~/Music -type f -mtime -145 -print0 | xargs -0 tar --null -cvf backup.tar