Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to delete files in batch by moa 35

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "moa 35 how to delete files in batches", the content in the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "moa 35 how to delete files in batches"!

Under an application directory, a large number of directories and files that start with numbers are generated, such as

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5925.26

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5926.596

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5927.284

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5931.467

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5931.585

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5936.315

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5937.906

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 594.1117

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5942.766

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5944.112

-rwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5945.207

-rwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5945.499

-rwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5948.318

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5949.521

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5955.708

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5956.432

Drwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5958.177

-rwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 596.4732

-rwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5961.223

-rwxr-xr-x 2 wasuser wasgrp 256 Apr 09 15:56 5961.466

Delete Times in bulk

Bash: / bin/rm: Argument list too long

There are too many files in the directory to delete them all.

So how do you delete all the files in this directory? (there are a large number of files and directories in this directory)

Analysis of the reasons for reporting errors:

For example, you have a.tmp, b. Tmp. TMP. TMP.

Performing rm * is actually replaced by rm a.tmp b.tmp c.tmp d.tmp. Execute later

If there are many files in the directory, the length after replacement will cause an error because it exceeds the maximum length of the system's default command buffer, so the number of characters to be deleted in batches needs to be simplified.

$id

Uid=212 (wasuser) gid=210 (wasgrp) groups=1 (staff)

$pwd

/ moaj2me/document/resources/doc

$rm-rf [1-9] * Note: if it is a letter, then rm-rf [Amurz] * rm-rf [Amurz] *

$ls-l

Total 0

Another way is to

Find. -print | xargs rm-rf

Find. -name *-exec rm-rf {}\

Ls-l | awk'{print $9}'| rm-rf

Note: r and f parameters of rm should be used with caution

You can also use scripts

The recommendations are as follows:

Ls-l > / tmp/rmfile.sh

Cd / tmp

Vi rmfile.sh

: G / ^ / s//rm / g

ZZ

Chmod 755 rmfile

. / rmfile

Add:

Delete all files in the current directory (excluding directories):

Find. -maxdepth 0-type f-exec rm-f {}\

The method of batch deleting empty files (files whose size is equal to 0)

Find. -name "*"-type f-size 0c | xargs-n 1 rm-f

You can also delete files of specified size by changing the corresponding-size parameter, for example:

Find. -name "*"-type f-size 1024c | xargs-n 1 rm-f

Is to delete files of 1k size. (but be careful not to use-size 1k, which results in 1k of space, not a file size of 1k).

Find. -maxdepth 0-type f-name xxx.*-mtime + 2-exec rm-f {}\

Delete all files starting with xxx that were modified 2 days ago

Thank you for your reading, the above is the content of "moa 35 how to delete files in batches", after the study of this article, I believe you have a deeper understanding of how to delete files in batches of moa 35, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report