Friday 8 January 2010

A "diff"-icult problem

Sorry, I couldn't help myself.

Writing the file copying routines for the "diff for folders", I've come across the small problem of converting from the non-escaped versions of file names that readdir produces, to the escaped versions that the shell commands need.  I have, however, managed to produce a imho pretty nice oneliner to do this.
join("\\ ", split(/ /, $fileName));
 Which takes a file name like "some random file.txt" and converts it to "some\ random\ file.txt". Obviously, this won't work directly from the command line yet, but when I've got more time I'm going to adapt it to do so.

No comments:

Post a Comment