1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Cron Job to clean a directory and keep index.html

Discussion in 'Site & Server Administration' started by Ricardo Corai, Mar 26, 2015.

  1. #1
    Hi,

    I'm using CPanel and I need to clean a tmp directory but keep index.html for security reasons. What's the command should I use to clean everything except index.html?

    Thanks.
     
    Ricardo Corai, Mar 26, 2015 IP
  2. TheSHosting

    TheSHosting Member

    Messages:
    24
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    48
    #2
    What level of access you have; just cPanel level access? Anyway, a command like following will remove all files except index.html. So you can create a script with following content and set it as a cron and it should work.

    PS: make sure to replace <complete path to dir> with full path to the tmp directory.
     
    TheSHosting, Mar 27, 2015 IP