2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

find で巨大なファイルを検索する

Posted at

とあるプロジェクトのコードをまとめてgithubに放り込もうとしたところ

remote: error: GH001: Large files detected. You may want to try Git Large File Storage

でかいファイルをあげちゃいけないんですね。
すかさずググる。

GithubとBitbucketのストレージ周りのお話
http://qiita.com/t_yamatoya/items/fec5c5285f56eb4def99

ほほう。100MB以上はアウトとな。
では早速検索してみましょう。

findのmanから抜粋

-size n[ckMGTP]
     True if the file's size, rounded up, in 512-byte blocks is n.  If n is followed by a c, then the primary is
     true if the file's size is n bytes (characters).  Similarly if n is followed by a scale indicator then the
     file's size is compared to n scaled as:

     k       kilobytes (1024 bytes)
     M       megabytes (1024 kilobytes)
     G       gigabytes (1024 megabytes)
     T       terabytes (1024 gigabytes)
     P       petabytes (1024 terabytes)

というわけで

find ./ -size +100M; # 100Mbyte以上のファイルを検索する

そんだけです。

おまけ:カレントディレクトリのファイルをファイルサイズの逆順にソート

ls -Slr

でかいファイルがターミナルの一番下に表示されるので便利。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?