###Ruby, score 505.4 (560 characters)###
Ruby, score 505.4 (560 characters)
x,a,b=gets.chomp.split f=IO.read('F') e=f[0,4*X=248].unpack 'A4'*X s=f[4*X,2*X].unpack 's'*X d=f[6*X..-1].unpack 'A'+s*'A' u,v,w,y=[[N=nil,q=e.index(a),!t=e.index(""),"e[t]=a;s[t]=(d[t]=IO.binread('I')).size"],[!q,r=e.index(b),!t,"e[t]=b;d[t]=d[q];s[t]=s[q]"],[!q,N,N,"e[q]=d[q]='';s[q]=0"],[!q,r,N,"e[q]=b"],[!q,N,N,"IO.binwrite('O',d[q])"],[N,N,N,'X.times{|i|e[i]>""&&puts(e[i]+" #{s[i]}")}']]['ICDROL'=~/#{x}/i] u&&$><<"ERR1\n"||v&&$><<"ERR2\n"||w&&$><<"ERR3\n"||eval(y) d=d*"" d.size>63488&&$><<"ERR3\n"||IO.write('F',(e+s+[d]).pack('A4'*X+'s'*X+'A63488')) Notes:
- Filesystem is located in file
Fin the current directory.Fmust exist and may be created/formatted via the following command:IO.write('F',(([""]*248)+([0]*248)+[""]).pack('A4'*248+'s'*248+'A63488')). - Input file is always
Ialso in the current directoy, output file isO. - Since it wasn't required to check errors, be sure to type correct commands (i.e. no unsupported commands, no missing arguments, too long filenames).
- The file system implementation is extremely simple - for each command the full hard drive is read into memory and rebuild upon (successful) completion.
Bonuses:
- Filenames may be 1-4 chars
- Commands may be upper or lower case
The code is not yet fully golfed but shows already that for a substancial better score I'd try a completely different approach.
Test session (only STDIN/STDOUT is shown but of course each command is prepended by calling the above program):
> L > I F001 > L F001 558 > I F001 ERR2 > C F002 F003 ERR1 > C F001 F003 > L F001 558 F003 558 > C F001 F003 ERR2 > R F002 F003 ERR1 > R F001 F003 ERR2 > R F001 F002 > L F002 558 F003 558 > O F001 ERR1 > O F002 > L F002 558 F003 558 > D F001 ERR1 > D F002 > L F003 558 > C F003 F001 > L F001 558 F003 558 > D F001 > L F003 558 > D F003 > L