zoukankan      html  css  js  c++  java
  • 删除带特殊符号的文件夹

    通过 Inode 删除文件

    1、查看文件inode

    ls -i

    eg:
    aidcsa1@CANGZDLMSS03:/users/aidcsa1> ls -il 
    total 44
    3278052 -rw-r--r-- 1 aidcsa1 hpsecg00   68 2017-03-14 15:34 a
    3278079 -rw-r--r-- 1 aidcsa1 hpsecg00  894 2017-04-10 10:52 a.pyc
    3276860 drwxr-xr-x 2 aidcsa1 hpsecg00 4096 2014-03-18 16:57 bin
    3277552 -rw-r--r-- 1 root    root     8128 2017-04-07 00:00 CANGZDLMSS03-dormant.txt
    3301414 drwxr-xr-x 3 aidcsa1 hpsecg00 4096 2017-04-12 17:13 checkID
    3277732 -rwxr-xr-x 1 aidcsa1 hpsecg00  475 2010-06-15 20:38 dormant-cmd
    3276862 -rw-r--r-- 1 root    root      879 2014-03-18 17:01 id.txt
    3276863 -rw-r--r-- 1 root    root     7401 2014-03-18 17:15 login log.txt
    3301393 drwxr-xr-x 3 root    root     4096 2016-12-08 09:58 test


    2、删除对应文件

    法一:rm `find . -inum 3278079`;

    eg:  删除inode为3278079 的a.pyc文件

    aidcsa1@CANGZDLMSS03:/users/aidcsa1> rm `find . -inum 3278079`
    aidcsa1@CANGZDLMSS03:/users/aidcsa1> ls -li
    total 40
    3278052 -rw-r--r-- 1 aidcsa1 hpsecg00   68 2017-03-14 15:34 a
    3276860 drwxr-xr-x 2 aidcsa1 hpsecg00 4096 2014-03-18 16:57 bin
    3277552 -rw-r--r-- 1 root    root     8128 2017-04-07 00:00 CANGZDLMSS03-dormant.txt
    3301414 drwxr-xr-x 3 aidcsa1 hpsecg00 4096 2017-04-12 17:13 checkID
    3277732 -rwxr-xr-x 1 aidcsa1 hpsecg00  475 2010-06-15 20:38 dormant-cmd
    3276862 -rw-r--r-- 1 root    root      879 2014-03-18 17:01 id.txt
    3276863 -rw-r--r-- 1 root    root     7401 2014-03-18 17:15 login log.txt
    3301393 drwxr-xr-x 3 root    root     4096 2016-12-08 09:58 test


    法二:find . -inum 3278052 -exec rm -i {} ;

    eg:删除inode为3278052 的a文件

    aidcsa1@CANGZDLMSS03:/users/aidcsa1> find . -inum 3278052 -exec rm -i {} ;
    rm: remove regular file `./a'? y
    aidcsa1@CANGZDLMSS03:/users/aidcsa1> ls -il
    total 36
    3276860 drwxr-xr-x 2 aidcsa1 hpsecg00 4096 2014-03-18 16:57 bin
    3277552 -rw-r--r-- 1 root    root     8128 2017-04-07 00:00 CANGZDLMSS03-dormant.txt
    3301414 drwxr-xr-x 3 aidcsa1 hpsecg00 4096 2017-04-12 17:13 checkID
    3277732 -rwxr-xr-x 1 aidcsa1 hpsecg00  475 2010-06-15 20:38 dormant-cmd
    3276862 -rw-r--r-- 1 root    root      879 2014-03-18 17:01 id.txt
    3276863 -rw-r--r-- 1 root    root     7401 2014-03-18 17:15 login log.txt
    3301393 drwxr-xr-x 3 root    root     4096 2016-12-08 09:58 test
  • 相关阅读:
    JAVA并发-join
    JAVA并发-同步器AQS
    【转载】Kafka史上最详细原理总结
    Kubernetes部署Spring Boot应用
    Kubernetes 资源对象
    Kubernetes Pod的数据卷Volume
    三块sm865组建RAID0
    三星固态Dell版的960g的sm863a硬盘
    如何使用 Gin 和 Gorm 搭建一个简单的 API 服务 (三)
    如何使用 Gin 和 Gorm 搭建一个简单的 API 服务 (一)
  • 原文地址:https://www.cnblogs.com/shellphen/p/13521966.html
Copyright © 2011-2022 走看看