132kb "*.exe"ファイルをすべて削除する方法

132kb

filename.exe私の外付けハードドライブが132.6kbの大容量コピーを作成するWindowsウイルスに感染しています。

書いてみると、find . -type f -name "*.exe"何千もの.exeファイルが見つかりますが、そのうち100〜200個だけが私のものです。

データを失うことなくウイルスファイルを抽出して一度に削除する賢い方法を知っていますか?

ベストアンサー1

findオプションで使用-size:

find . -type f -iname '*.exe' -size 133k

または

find . -type f -iname '*.exe' -size 135783c

ファイルが間違っていると確認された場合は、-deleteコマンドにオプションを追加してそのファイルを削除できます。

からman find

   -size n[cwbkMG]
          File uses n units of space, rounding up.  The following suffixes can be used:

          `b'    for 512-byte blocks (this is the default if no suffix is used)

          `c'    for bytes

          `w'    for two-byte words

          `k'    for Kibibytes (KiB, units of 1024 bytes)

          `M'    for Mebibytes (MiB, units of 1024 * 1024 = 1048576 bytes)

          `G'    for Gibibytes (GiB, units of 1024 * 1024 * 1024 = 1073741824 bytes)

          The size does not count indirect blocks, but it does count blocks in sparse files that are not  actu‐
          ally allocated.  Bear in mind that the `%k' and `%b' format specifiers of -printf handle sparse files
          differently.  The `b' suffix always denotes 512-byte blocks and never 1024-byte blocks, which is dif‐
          ferent to the behaviour of -ls.

          The  +  and  -  prefixes signify greater than and less than, as usual; i.e., an exact size of n units
          does not match.  Bear in mind that the size is rounded up to the next unit. Therefore  -size  -1M  is
          not  equivalent  to  -size  -1048576c.  The former only matches empty files, the latter matches files
          from 0 to 1,048,575 bytes.

おすすめ記事