假设我有一个仅包含文件的Dir1(t1.txt,t2.txt,t3.txt) ,我如何仅在bash脚本中获取文件名列表,该脚本允许我将其与Dir2中的另一个文件列表进行比较,并且在不使用rSync的情况下查找丢失的文件
diff -r --brief Dir1 Dir2
will tell you the differences between two directories, including when one directory contains a file that the other one doesn't. Incidentally, it will also tell you if Dir1 and Dir2 both contain a files with the same name, say t1.txt , but with different contents. It won't print files that are the same between the two directories.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.