Hi, I write a script that take a list of files from STDIN, compute some stuff, and copy files with a new names.

I got 33k lines at input but got only 3k-5k in the destination folder.
This is not append if I remove the .parallel() function.

What did I do wrong?

    void delegate(string source,string dest) handler;

    if(use_symlink) handler = delegate(string s,string d){
        symlink(s,d);
    }; else handler = delegate(string s,string d){
        copy(s,d);
    };

    foreach(entry; parallel(stdin.byLineCopy)) try
    {
        auto source = buildPath(static_path,entry);
        auto md5 = digest!MD5(File(source).byChunk(64*1024));
        auto hash = toHexString!(LetterCase.lower)(md5);
        auto file = text(hash,'_',baseName(entry));
        auto dest = buildPath(hashed_path,file);
        handler(source,dest);
        writeln(entry,' ',file);
    }
    catch(Exception e)
    {
        error("Couldn't read, hash or copy %s",entry);
    }

Reply via email to