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!

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:
    10
    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 II
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    3,517
    Likes Received:
    251
    Trophy Points:
    193
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice