17
1
Objective
You are to write a program that receives an integer n
as input (from the command line), and embeds itself (the program) n
directories down the directory tree. Example with n=5
:
The folder names may be whatever you wish. The only requirements are that the depth is correct, and that the program can then be ran again from its new spot in the directory tree, and that the new source file retains the same filename.
Bonuses:
- Score * 0.9 If the directories all have a different name (must be true at least to depth 1 000 000)
- Score * 0.5 If you do not directly or indirectly read or move the source file, or access the source code of the program
1What counts as "reading the source"? You mean the file? Or the real source code? – GiantTree – 2015-01-05T00:04:00.753
The file. Will clarify in post @GiantTree – globby – 2015-01-05T00:04:30.093
@globby What do you mean by 'do not read the source file of the program'? – unclemeat – 2015-01-05T01:47:56.933
Copying the exact source into the directory, without explicitly reading the file that your source code is in. Basically make a quine that drops itself into another directory. Sorry if I'm not explaining it well – globby – 2015-01-05T01:56:40.127
@globby So execution of the CMD command
move
does not count as reading the source file? – unclemeat – 2015-01-05T02:04:11.4972@unclemeat It does, because to move the file you (or the system) has to access the data in the file. – globby – 2015-01-05T02:05:57.183
25Seems like you are just trying to hide your porn stash. – Ablue – 2015-01-05T03:57:36.137
1I'm not paying enough attention to tell; is the [quine] tag appropriate? – Justin – 2015-01-05T07:13:00.973
3@globby how about the
ln
command in *nix? If I'm not mistaken, it's just creating another entry to the file inode, and no content is read at all. – h.j.k. – 2015-01-05T08:18:33.720Seriously don't need to write a quine this late... – Isiah Meadows – 2015-01-05T08:33:18.900
7@globby As far as I'm aware, moving a file does not read the contents, unless you're moving between hard drives or partitions. It's basically just changing some pointers in the file system. – Martin Ender – 2015-01-05T09:10:25.030
@MartinBüttner fair. Updated the original post. – globby – 2015-01-05T15:36:40.750
Unique names up to depth 1 000 000? If I see code which promises to do that, but looks like the cat danced on the keyboard, I would never dare test it on my computer. Not with an input above 10, anyway. – rumtscho – 2015-01-05T17:57:52.263
The logic just needs to work up to depth 1000000. You can modify the code to print the directory names instead of making them, or work out the logic on paper. – globby – 2015-01-05T18:03:31.957
A million nested subfolders? Hey man, some of us use Windows! – user1354557 – 2015-01-07T22:06:47.700
@MarkReed Look a few comments up – globby – 2015-01-08T15:43:20.697