8
The challenge is to detect missing integer sequences of files or directories. You have a directory filled with files/directories that are named as integers.
The files/directories are generated from multiple threads yet the job did not complete - there are therefore gaps in the sequence.
The input is two integers a start and an end, and your task is detect the starting integer of the next missing sequences. You may presume that all files and directories in the directory where run have only integer named files or directories.
Acceptable answer forms: functions, code snippets - they must run on the command line.
Acceptable start/end input: included on the command line, env variables/argv are okay, parameters to functions, user input is okay.
Shortest code wins.
Update -- Although I managed to squeeze out this one, there were many interesting answers. The idea in apricotboy's Bash answer was used in part to help me design my 35 Byte Bash answer. Best of luck on the next one.
E.g. Presume files 1,2,3,4,7,8,9,10,18 are present, start is 1, end is 20:
The output should be:
5
11
19
2Can I input an array instead of reading my own files? – Leaky Nun – 2016-07-26T02:16:30.870
5
It seems a rather pointless extra requirement to me.
– Leaky Nun – 2016-07-26T02:18:48.4502
@A.Danischewski I find the real-world background here is too much of a narrow reference to justify the file requirement.
– xnor – 2016-07-26T02:34:57.9672Can I just delete all files and print 1? – orlp – 2016-07-26T02:36:03.477
4This is absolutely a chameleon challenge - the requirement to take input as file names and/or directories makes this challenge more about working with the filesystem than actually filling in the holes. – Mego – 2016-07-26T02:53:24.863
14You all complain too much whenever there's a challenge requiring any functionalities other than shuffling integers or strings around. – feersum – 2016-07-26T02:56:06.743
Related, possibly a dupe target since it's mostly the same challenge, but without the unnecessary requirement of doing filesystem I/O. – Mego – 2016-07-26T02:56:49.410
3@feersum We complain when challenges arbitrarily require extra functionality (like filesystem I/O) that don't add anything to the actual challenge. – Mego – 2016-07-26T02:57:47.767
@Mego How do you determine whether a thing is a thing or not a thing? – feersum – 2016-07-26T02:59:43.183
4@feersum How is finding missing integers in sequence related to finding files in directory? – Leaky Nun – 2016-07-26T04:52:53.877
May we output a list of missing names? – Adám – 2016-07-26T05:39:37.820
Can any of the arguments be negative? – Leaky Nun – 2016-07-26T05:47:40.493
Ok so do we have to write IO code or not? I solved the non-IO part of the problem... – applejacks01 – 2016-07-26T14:44:46.400