In the work often encountered in a file to record a number of file name or picture name, in the specified directory to find all the files in this file, but the specified directory does not have all the names recorded in the file, you need to find in the specified directory in this file all the files recorded, if not exist the file is recorded!
Script instance:
All the file names that need to be found are recorded in Pic.txt
[email protected] tmp]# cat find_pic.sh #!/bin/bashcat pic.txt | While read linedoif [-f/usr/local/war/static/ftp_product_img/$line];then find/usr/local/war/static/ftp_product_img /-name $line-exec cp {}/tmp/pic \;else echo "$line not_exist!" >>/tmp/find_pic.logfidone
This article is from the "burning Years of Passion" blog, please be sure to keep this source http://liuzhengwei521.blog.51cto.com/4855442/1964273
The shell script records the files that are not stored