Monday, December 9, 2019

How to Delete million of file in certain directory

How to Delete million of file in certain directory.

When administrator get request for deleting files which having large number, then simple "rm" command will not work. Solution to this problem is following command.

find . -type f -name "*.bak" -exec rm -i {} \;

Above command will find files with ".bak" extension and will delete them. IF administrator want to specify any specific path then he also specify that path like below.

find /backup -type f -name "*.bak" -exec rm -i {} \;

2 comments:

  1. Hi sir
    I am following ur blogs and it is very useful for...its really appreciated...thank a lot for making aix blog

    I have a some question please answer this question....

    Please give me a answer step by step ....

    1)root filesystem 100% full.how to resolve it in aix

    2) /var is full in aix how to resolve it

    3)how to monitor aix server ....i am using vmstat iostat sar netsatat command....what are d main output we hv to remember always to find issues...

    Thanks and regards
    Sandeep

    ReplyDelete