find rename 指令碼

來源:互聯網
上載者:User

標籤:find   rename   

6.修改檔案尾碼名

rename .c .h *.c


7.find 用法

1.find  /home  -mtime  -2                 在/home下查最近兩天內改變過的文檔

2.在/ l o g s目錄中尋找更改時間在5日以前的文檔並刪除他們:

$ find logs -type f -mtime +5 -exec  -ok  rm {} \;

3.find  -name april*                      在目前的目錄下尋找以april開始的文檔

4.find /home/scripts/ -type f -name "*.sh"   在/home/scripts下尋找特定尾碼為.sh的檔案

5.find . -name "*.sh" -mtime +7 -type f    尋找7天前這個目錄下.sh的檔案

6.find ./ -name "*.c" | awk -F "." ‘{print $2}‘ | xargs -i -t mv ./{}.c  ./{}.h  目錄及子目錄全


7.find 目錄 -name "*.sh" | xargs rm 刪除相同尾碼的檔案名稱

8.rename 2.sh 2 *   在目前的目錄下 將2.sh 替換成2

9.用指令碼尋找7天前的.sh的檔案,並將.sh尾碼替換成.log

for file in $(find . -name "*.sh" -mtime +7 -type f )

do

  rename .sh .log *

done

10.用指令碼將7天前的.sh檔案找出。並將全部刪掉

#!/bin/bash

#

rm $(find . -name "*.sh" -mtime +7 -type f )


find rename 指令碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.