shell 文件操作

 
  
  在linux平台下开发,我们经常会接触到一些任务性质的工作,而处理方式多样化。现积累各个案例。
 
从远程服务器拉取文件到本地服务器
  
scp work@cp01-xx-dev.com:/home/xx/data/relation/filename ./
 
清理近7天的数据
  
  日志文件越来越大,我们需要及时的去做清理工作。配合工具:find,xargs
 
#!/bin/bash
for p in `find ./ -type d -name log`; do
  find "$p" -mtime +7  | xargs -i rm -f {} &
done

  

原文地址:https://www.cnblogs.com/baochuan/p/4666483.html