22
6
If a compiled language is used, the program must delete the compiled executable (but need not delete the source file). If an interpreted language is used, the program must delete the source file.
My opening bid:
Python (29 characters)
import os;os.remove(__file__)
Edit: to prevent solutions like rm -rf /, the program must not delete anything except the executable or source file.
html,body{margin:0;padding:0;height:100%;overflow:hidden}
<iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=19355" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe>
You might as well use a newline instead of a semicolon for the python answer. It's the same number of bytes and it's more readable. – Esolanging Fruit – 2017-05-07T11:40:00.883
May the submission be a function or does it have to be a full program? – FlipTack – 2017-12-04T20:26:55.310
possible duplicate of Write a program that deletes itself
– John Dvorak – 2014-01-25T03:39:04.4672@JanDvorak That question was stricter, requiring a .exe file. This is more lax. – EMBLEM – 2014-01-25T03:39:50.113
Hmm... what if I vote to close in the opposite direction, then? – John Dvorak – 2014-01-25T03:41:14.370
@JanDvorak That would be excellent! And a first, an old question closed in favour of a newer one. – EMBLEM – 2014-01-25T03:41:55.873
Vote cast. Now let's wait and see :-) – John Dvorak – 2014-01-25T03:43:52.387
3code-golf, not [tag:popularity-contest]? Aww. – Justin – 2014-01-25T04:19:08.820
10@Quincunx I don't believe in popularity contests. Real code is not first validated on its elegance, but its correctness. – EMBLEM – 2014-01-25T04:24:27.913
Obviously relevant: http://youtu.be/Z86V_ICUCD4
– Adam Maras – 2014-01-25T07:37:56.270@JanDvorak Okay, so prefer the trivial question where interpreted languages can do it with no problem. – Cruncher – 2014-01-27T14:23:49.923
@EMBLEM I think you may be on the wrong forum. Also, I disagree that this is a duplicate. The linked problem specifically asks for a windows executable, which is a different problem statement entirely.
– primo – 2014-01-31T11:17:17.180you have to actually delete the file, truncating it doesn't count? – None – 2014-05-29T13:28:02.697