zoukankan      html  css  js  c++  java
  • linux获取目录下文件

    查看当前目录下的文件:
    find . -type f

    查看当前目录下的文件夹:
    find . -type d

    如果文件file1不为空:
    if [ -s file1 ];then
         echo "file1 不为空"
    fi

    #!/bin/sh
    for in `find ./testdir -type f`;
    do
            if -s $f ];then
                    echo $f is not empty.
                    echo copy $f
                    cp $f ~/backup
            else
                    echo $f is empty.
            fi
    done
     
     
     
    #!/bin/bash
    find /etc -type f > list.txt
    while read line; do
        size=$(ls -l $line | awk '{print $5}')
        if [[ $size != 0 ]]; then
            cp $line /tmp/
        fi
    done < list.txt
  • 相关阅读:
    ctrl+shift+k取消
    ERROR 1872
    swap
    mysql主从跳过错误
    undo
    gtid
    falcon监控指标
    连接数
    datetime与timestamp相互转换
    截取文件内容
  • 原文地址:https://www.cnblogs.com/zmlctt/p/3700265.html
Copyright © 2011-2022 走看看