How to delete a directory on restart

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • diwakar09
    New Member
    • Sep 2007
    • 39

    How to delete a directory on restart

    Hi,

    Is there any in c/c++ through which i can mark some directory or files for deletion, But this deletion should happen only on next restart of system.
    I have to implement it in a application that will run on linux and mac.

    Thanks in advance.
  • mac11
    Contributor
    • Apr 2007
    • 256

    #2
    Originally posted by diwakar09
    Hi,

    Is there any in c/c++ through which i can mark some directory or files for deletion, But this deletion should happen only on next restart of system.
    I have to implement it in a application that will run on linux and mac.

    Thanks in advance.
    With C or C++ you can delete files, but I'm not aware of anything that will allow you to schedule files for deletion at next system start.

    One way that comes to mind, at least for Linux, is to make a startup script that reads a file which tells it what files/directories to delete. Then when your C program wants to schedule a file for deletion it just adds an entry to that file. Then next time you reboot the statup script will come along and do the deletions.

    I haven't worked on a mac but they might be similar enough to linux that the same scheme would work there too.

    Comment

    • diwakar09
      New Member
      • Sep 2007
      • 39

      #3
      Originally posted by mac11
      With C or C++ you can delete files, but I'm not aware of anything that will allow you to schedule files for deletion at next system start.

      One way that comes to mind, at least for Linux, is to make a startup script that reads a file which tells it what files/directories to delete. Then when your C program wants to schedule a file for deletion it just adds an entry to that file. Then next time you reboot the statup script will come along and do the deletions.

      I haven't worked on a mac but they might be similar enough to linux that the same scheme would work there too.
      Thanks for your reply.
      I was also thinking the same, But i thought there must be some other way,
      Any ways, once again thanks for your reply.

      Comment

      Working...