Quantcast
Channel: OKWAVE 最新質問(OS(技術者向け)/233)【本日】
Viewing all articles
Browse latest Browse all 9758

ファイルを検索して削除する

$
0
0
/www 以下のディレクトリーに aaa.txt というファイルが存在する場合、 そのファイルが存在するディレクトリー内の全ての ***.txt を削除したいです。 find /www -name aaa.txt | xargs rm だと、aaa.txt だけの削除になります。 以下も考えましたが、これだと検索対象ディレクトリーが /www だけになります。 #!/bin/bash if test -e /www/aaa.txt then rm -f /www/*.txt fi どのように記述するとよいでしょうか。

Viewing all articles
Browse latest Browse all 9758

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>