假设我有一个文件夹\ home \ mybackup,文件夹中的结构是:
\home\mybackup\file1.txt
\home\mybackup\file2.txt
\home\mybackup\subfolder\<a lot of file and sub directory in subfolder>
我希望将mybackup中的每个文件或子文件夹压缩(或其他压缩方式)为zip文件(如果它们在一周内创建或修改)。 mybackup中它们的结构应该保持不变,因为我稍后将它解压缩到\ home \ mybackup_new。怎么做?
我转到\ home \ mybackup,尝试过:
find . -maxdepth 1 -mtime -7 -exec zip -r zipfile2.zip {} +
但它显示错误:
zip warning: first full name: ./information/
second full name: information/
name in zip file repeated: information/
如果我尝试:
find \home\mybackup -maxdepth 1 -mtime -7 -exec zip -r zipfile2.zip {} +
无论日期如何,它都会拉链。