Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Remove a particular file type from server?

Discussion in 'Workarounds and Optimization' started by Rajesh Chauhan, May 17, 2018.

  1. Rajesh Chauhan

    Joined:
    Jan 18, 2016
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    cPanel Access Level:
    Root Administrator
    I want to remove some particular file extensions like we have a server with lots of unused zip files and we want to remove all zip files from the server and if is there any way to set auto-delete particular file extensions for the customers like .txt, mp3, mp4 etc to avoid space abuse.
     
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    944
    Likes Received:
    66
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Rajesh Chauhan

    A simple find command would do the trick here, similar to:
    Code:
    find / -name "*.gz" -type f -delete
    Though I would want to know what would be removed before running, to do that you can run the find command without -delete like so:

    Code:
    find / -name "*.gz" -type f
    Keep in mind running from / is going to take a long time for larger filesystems. You might want to read up on find before running anything like this though find(1) - Linux man page or simply
    Code:
    man find
    from the CLI
     
Loading...

Share This Page