• evil muffin (unregistered)

    I'm very new to Java, but I think this should generate the same effect (only faster and cleaner ;)

    public void copyFile(File sourceFile, File destFile) throws Exception {
      if(!sourceFile.canRead()) {
        throw new IOException("Could not read file " + sourceFile.getPath());
      } else if (!sourceFile.getParentFile().canWrite()) {
        throw new IOException("Directory " + destFile.getParent() + " not writable.");
      }
    
      sourceFile.renameTo(destFile);
      if(!destFile.canRead()) {
        throw new IOException("Could not \"copy\" file " + sourceFile.getPath() + " to " + destFile.getPath());
      }
    }
  • (cs) in reply to ailivac
    ailivac:
    I can't believe no one else has mentioned another huge error in this. I guess you people haven't worked with a unix shell enough to know which characters are OK to use in command lines and which need special processing.

    This is obviously designed to run on windows, where directories commonly have names like "My Documents," "Program Files" and "Application Data." All of those have a character in them that will make the batch file call fail instantly.

    Not only that, if your path has a space it it, it will also fail (or copy and delete the wrong file). (unless getAbsolutePath puts quotes around it for you).

  • Pyrolistical (unregistered) in reply to M.G.

    Know what? This is what my copy function first looked like as well, but then I ended up changing to use the os's command line copy function just like in the WTF.

    Why would I do that? I found the os' copy function so much faster than the code below.

    M.G.:
    File sourceFile = new File(...);
    long fileSize = sourceFile.length();
    ...
    FileInputStream input = new FileInputStream(...);
    FileOutputStream output = new FileOutputStream(...);
    inputChannel = input.getChannel();
    outputChannel = output.getChannel();
    long transferSize = inputChannel.transferTo(0, fileSize, outputChannel);
    if (tranferSize != fileSize) { // Didn't transfer the while file, do something about it here }
    // Sorry, you still have to close things yourself...
    

    Does that help?

  • Trix (unregistered) in reply to anonny
    anonny:
    It uses a combination of COM and the already-ridiculed "allocate a buffer, do a read, do a write" pattern. It's done like this so that Vista can show the exact byte progress and copy speed of the operation.

    Of course, that's much slower than having NTFS do the copy, especially because it involves COM invocations.

    OMG, no more "Microsoft minutes", where the file copy time is given as 111 minutes, then (30 seconds later) 20 minutes, then 93 minutes, then (2 minutes later) the copy is finished?

    Almost worth getting Vista for?... nah.

  • Disgruntled Postal Worker (unregistered) in reply to Asd
    Asd:
    ailivac:
    The true WTF is that Java doesn't have a standard or sane way of installing extra libraries, so programmers have to reinvent broken wheels like this all the time.
    Bwuh? Just drop commons-io.jar into your classpath. Most Java applications use dozens of open source libraries.

    Java 7 or 8 is supposed to get a new and improved file system.

    I also noticed their IO util methods don't seem to throw IOException. I wonder do they use RuntimeExceptions (unchecked exceptions), or, more likely, just ignore them.

    Commons-io doesn't solve the lingering file-locks you have in Java on windows. You copy a file, delete the original, but some object that hasn't been garbage collected yet still keeps a lock on the original doesn't get deleted.

    Delete on exit doesn't always work reliably either, and in any case you may never want your JVM to exit in the first place.

    I'm guessing that whoever wrote this thing, was trying to detach the copying from the JVM in frustration over the lingering file-lock problem.

    And by the way, no exceptions are thrown by this kind of IO, success or failure is indicated by returning a boolean

  • me (unregistered) in reply to dkf
    dkf:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.
    stick to coding, dude. leave the copy editing to people who know how shit is spelled.
    Oh, how have the mighty fallen! If you don't recognize a reference to http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx straight off, you should either hang your head in shame or go directly to that article and enjoy...

    Well unfortunately I did go to that article and although it was hilarious I felt that I had to make the following perhaps off topic comment. I was disgusted at the amount of sexist remarks it contained that insinuated that the gender of the person in question had anything to do with the bad code. It has actually really put me off this site tbh. There are bad female programmers and there are bad male programmers, end of story. Its unbelievable to me that some people could equate someone writing pathetic code with them being a slut. Disgusting actually. Some of these so called "comments" should be moderated with a male AND female audience in mind.

  • (cs)

    I think the copying via copyfile.bat has the purpose of processing the copied files along the way.

    Yeah, as simple as that. No real wtf.

  • Jesus (unregistered) in reply to Nojazz Song Hurts

    People who don't see the mistake like you makes me speechless.

    This code has absolutely no error checking, will fail in 10% of the cases (since it doesn't handle space in filename), is locked to Windos (without telling anyone, it'ss simply fail on other platforms), and when it failes it goe3s catastrofically wrong, again without telling anyone.

    It might have worked for the original intendes use, but when programmer B comes along, sees a function called CopyFile, hel get into quite a bit of trouble before he finaly reads the source and end up writing his own copy function. In other words: a perfect example of completly useless and utterly harmfull code.

  • Adam (unregistered) in reply to ailivac
    ailivac:
    I can't believe no one else has mentioned another huge error in this. (...)

    This is obviously designed to run on windows, where directories commonly have names like "My Documents," "Program Files" and "Application Data." All of those have a character in them that will make the batch file call fail instantly.

    Err..that's the bit that perplexes you about it's portability? Not the batch-file syntax, using "copy"? Not the use of the windows' specific "C:" drive? If a skyscraper were constructed on a giant rice-cracker floating down a river, you wouldn't very-well point out that the windows needed cleaning. But yes. Point taken :o)

  • (cs) in reply to real_aardvark
    real_aardvark:
    gwenhwyfaer:
    real_aardvark:
    No, the "programmer" is clearly not thinking outside the box.
    But arguably should be put back into it as quickly as possible.
    What; and wrapped up with a nice pink bow and sent to <pick company of one's choice here> as Chief Architect?
    Yes. A company in Australia. By surface mail. Via Ontario.
  • anon (unregistered) in reply to me
    me:
    dkf:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.
    stick to coding, dude. leave the copy editing to people who know how shit is spelled.
    Oh, how have the mighty fallen! If you don't recognize a reference to http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx straight off, you should either hang your head in shame or go directly to that article and enjoy...

    Well unfortunately I did go to that article and although it was hilarious I felt that I had to make the following perhaps off topic comment. I was disgusted at the amount of sexist remarks it contained that insinuated that the gender of the person in question had anything to do with the bad code. It has actually really put me off this site tbh. There are bad female programmers and there are bad male programmers, end of story. Its unbelievable to me that some people could equate someone writing pathetic code with them being a slut. Disgusting actually. Some of these so called "comments" should be moderated with a male AND female audience in mind.

    snicker I, too, often wish WTF could be more sensitive.

  • Iwein (unregistered) in reply to Greatest CodeSOD ever
    Greatest CodeSOD ever:
    Yes, this is utterly stupid. First, a batch-file. Second, it's wasting time on copying when it could just use "move" instead. Third, it doesn't check if the copy operation was a success, and just deletes the source file when it's done.

    That is, it checks if the source file exists, AFTER it has attempted to copy it.

    Well there is a lot of things wrong with this code, but copy + delete is something fundamentally different from move. In very critical operations it is to be preferred over a move because it is safer.

    Clearly, however this was the least of the developers problems though :D.

  • (cs) in reply to gwenhwyfaer
    gwenhwyfaer:
    real_aardvark:
    gwenhwyfaer:
    real_aardvark:
    No, the "programmer" is clearly not thinking outside the box.
    But arguably should be put back into it as quickly as possible.
    What; and wrapped up with a nice pink bow and sent to <pick company of one's choice here> as Chief Architect?
    Yes. A company in Australia. By surface mail. Via Ontario.
    I'm sensing a hostility to Ontario here. Watch the silver pendulum ... you are very sleepy ... watch the pendulum ... you are going to sleep ...

    OK, you're right. That's got Ontario summed up.

    No need to bother Australia. Let's just both rip off the pink bow and put the twerp back in the box, where he belongs.

  • (cs) in reply to Quinnum
    Quinnum:
    Although java is pretty much made of libraries anyway - all those classes aren't really 'part of the language'. It's just a wonder that nobody at Sun has added a utility class like that to the standard java library given that it's so bloated with everything else...
    Hunter S. Thomson: RIP.

    res ipsa loquitor.

  • M.G. (unregistered) in reply to Pyrolistical
    Pyrolistical:
    Know what? This is what my copy function first looked like as well, but then I ended up changing to use the os's command line copy function just like in the WTF.

    Why would I do that? I found the os' copy function so much faster than the code below.

    I can believe that, at least.

    I'm suprised that nobody noticed I forgot to declare the type of my inputChannel and outputChannel. :) Normally I expect to take a heavy beating for that kind of omission.

  • command.com / cmd.exe (unregistered) in reply to Look at me! I'm on the internets!
    Anything wrong with:

    process.exec("copy file1 file2"); // windows

    Yes, you did not test it.

  • Nobody (unregistered) in reply to Tim

    So many comments and nobody noticed that the code does NOT work for the following reason :

    Runtime.exec does not execute in a shell - you use parameters or anything like that.

    What you can do is, that you execute command.com /c "batch.bat file1 file2".

    Same goes when you do this in unix

    sh -c "batch.sh file1 file"

  • woohoo (unregistered) in reply to Someone You Know
    Someone You Know:
    rd:
    bkendig:
    Jim:
    sure, it copies, but then it deletes the source!

    So, just copy it back then!

    Brilliant!

    "Brillant!" is the word you're searching for, I'm sure.

    Yes. If he's german, I'm shure.

    "brilliant" (english) = "brillant" (german)

    In german, the spelling was taken directly from the french "brillant", whereas the english spelling was not taken over, but derived indirectly from the french root "briller".

  • woohoo (unregistered) in reply to Mainc Mailman
    Mainc Mailman:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.

    stick to coding, dude. leave the copy editing to people who know how shit is spelled.

    You indeed correctly spelled 'shit', but "Someone You Know" also correctly spelled 'Brillant!'.

    Look it up, dude.

    Sorry, but no.

    The fact aside that one could be a little nicer than 'Mainc Mailman' when pointing out errors... but making fun of someone who is actually right does not make one look very good ;o)

    In english, it's "brilliant", the spelling was derived from french "brillant(e)"/"briller", but changed in the process.

    In german OTOH, it's "brillant", the spelling taken over directly from the french "brillant(e)".

    Look it up, dude.

    (e.g. bartleby.com for english only, dict.leo.org for german/english)

  • woohoo (unregistered) in reply to Packrat
    Packrat:
    It won't work if the program doesn't have write and execute access to the root directory--i.e. it requires what are usually administrator rights.

    Um... do you know anyone who is not logged in as administrator all the frickin' time when working on any version of windoze (at least on desktop systems)? ;o)

  • pga (unregistered) in reply to ailivac

    uh. yeah.. i did some work on that for a while... had to write a WHOLE FUCKING VISUAL BASIC routine to find all instances of " " and replace them with "</u> " so that it would escape the spaces. why the hell cant we just name Everything "bin/", "share/" "home/" "tmp/" and "lib/" (oh yeah because that wouldnt be Microsoft now would it... he Have to have c:\programs/ and c:\supportFiles/ and shit like that)

  • (cs)

    Is it a bird? Is it a plane? Is it Superman? Is it the Hubble telescope? Is it a dwarf planet?

    No, it's an inside joke going so far over woohoo's head that it displayed as a negative number and ended up on Error'd.

  • Matt (unregistered) in reply to Alex
    Alex:
    Another cool feature is that it will only "work" one time on any given PC, since it doesn't overwrite the batch file it already exists, so it just keeps running the first batch file ever created by the method. Genius!

    That won't cause it to stop working. Do you have to reinstall an application before executing it again? Last time I checked batch files could be executed more than once...

    Although someone could potentially edit the batch file and break it (or make it do something malicious) the batch file will still work if it isn't modified

  • Radioactive Man (unregistered) in reply to GuntherVB

    The goggles do nothing!

  • barfman (unregistered) in reply to Maks Verver
    Maks Verver:
    Assuming you work as a software developer: if you care at all about the credibility of the software industry, please do us a favor and choose another line of work. Or, alternatively, send a random sample of your work to alexp-at-WorseThanFailure.com.

    Nice one, a-hole. I love people like you. They figure that all software development boils down to understanding every problem with every snippet of code, never taking into account that some people generally specialize with a particular type of development, perhaps are new to the field of work and fresh out of college, or just never had to deal with a particular dilemma before. I also figure that the point of this site is that we can all be WTFers from time to time, and it is in the process of learning from our WTFs, and the WTFs of others, that we become better developers. Nope, in your case, I guess it's if you get burned on one method, you should throw in the towel.......... right?

    I've seen shit code before aplenty. We had a guy who worked for us who was doing pretzel back flips with sprocs that made absolutely no sense at all, and interface code that never met the spec and usually failed to do the most trivial of tasks. He got canned. So it goes. Well now he has a new job at a larger company where they can help to assist his intelligence better as to ascertain methodologies for writing code, and guess what? He's doing just fine. I'm really glad he didn't leave the line of work just because of some ego-driven code junkie who has the strict guidelines of a fascist turd.

  • I, Robot (unregistered)

    "it's rare that I'll come across a snippet of code that leaves me speechless"

    Rare? There were two in one day. I notice the absence of speech from you concerning this snippet: TCHAR name; _stprintf(&name, _T("\Storage Card\%s"), findData.cFileName); Install(&name, hInstance);

  • Valczir (unregistered) in reply to barfman
    barfman:
    Maks Verver:
    Assuming you work as a software developer: if you care at all about the credibility of the software industry, please do us a favor and choose another line of work. Or, alternatively, send a random sample of your work to alexp-at-WorseThanFailure.com.

    Nice one, a-hole. [...] fascist turd.

    Honestly, I'm on his side more than yours. Looking at the rapidly deteriorating quality of programs, it's pretty darn frustrating to be a programmer and hear about this kind of crap (although it IS funny, on occasion). Granted, he took his frustration out a bit harshly, but I agreed with his earlier comment.

    Due to the number of things wrong in this program, it's pretty hard to accept that someone who thinks this code is perfectly acceptable knows what he or she is doing. Granted, it may have simply been a mistake, a quick glance at the code without thinking before posting, but it's unlikely enough that I still am struck speechless by the fact that you defended that code.

    I'm still in college, and I was struck speechless before I even noticed everything wrong with that code. I could have noticed that it's screwy before I even started coding.

    But I'm beginning to rant, so I'm going to stop. Just keep in mind how it would look to you if you diagnosed 9 problems in a 10 line program, and someone told you he thought that code was acceptable. You'd probably think the same thing.

  • Sexist? (unregistered) in reply to me

    Sure thing, sweet cheeks, now why don't you wiggle your way back to the kitchen and let the boys get back to their discussion...

    Seriously, get a life and relax or avoid public internet forums.

  • Sexist? (unregistered) in reply to me

    Obviously the previous comment was meant to quote this post:

    me:
    dkf:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.
    stick to coding, dude. leave the copy editing to people who know how shit is spelled.
    Oh, how have the mighty fallen! If you don't recognize a reference to http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx straight off, you should either hang your head in shame or go directly to that article and enjoy...

    Well unfortunately I did go to that article and although it was hilarious I felt that I had to make the following perhaps off topic comment. I was disgusted at the amount of sexist remarks it contained that insinuated that the gender of the person in question had anything to do with the bad code. It has actually really put me off this site tbh. There are bad female programmers and there are bad male programmers, end of story. Its unbelievable to me that some people could equate someone writing pathetic code with them being a slut. Disgusting actually. Some of these so called "comments" should be moderated with a male AND female audience in mind.

  • dkf (unregistered) in reply to me
    me:
    I was disgusted at the amount of sexist remarks it contained that insinuated that the gender of the person in question had anything to do with the bad code.
    Well, there are just two observations to that.

    1. We're scathing towards everyone who should know better, OK? 2. Some people are arses. It was always thus.

  • dkf (unregistered) in reply to Andrew
    Andrew:
    There is *never* a good excuse to use Runtime.exec().
    Not true. Sometimes you need it for certain types of privilege separation, e.g. invoking setuid helper programs. Thankfully, you don't need it very often though, as it is not one of the nicer Java APIs. But it's much nicer than having a setuid Java binary (I've seen that. Once. I had a nice long chat with the developer, who won't be doing that again...) and the effort needed to build a client-server arrangement isn't always justifiable; sometimes Runtime.exec() is just the right answer.
    Why spawn a new process to move a few files?
    Yeah, using it for that is unnecessary. The code looked like it was written by someone who was used to writing shell scripts or batch files. I see that class of thing quite often, alas. (On the other hand, this is a particularly WTF?!y example of it.)
  • (cs) in reply to woohoo
    woohoo:
    Mainc Mailman:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.

    stick to coding, dude. leave the copy editing to people who know how shit is spelled.

    You indeed correctly spelled 'shit', but "Someone You Know" also correctly spelled 'Brillant!'.

    Look it up, dude.

    Sorry, but no.

    The fact aside that one could be a little nicer than 'Mainc Mailman' when pointing out errors... but making fun of someone who is actually right does not make one look very good ;o)

    In english, it's "brilliant", the spelling was derived from french "brillant(e)"/"briller", but changed in the process.

    In german OTOH, it's "brillant", the spelling taken over directly from the french "brillant(e)".

    Look it up, dude.

    (e.g. bartleby.com for english only, dict.leo.org for german/english)

    Sorry, but yes. I'm not German, or French, I just read this site more than you.

    Look it up, dude:

    http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx

  • Kuba (unregistered) in reply to Volmarias
    Volmarias:
    Java doesn't actually have an OS-level file copy method that can be called (you have to actually read in the file and write it out to a new file!), so I can understand their twisted logic to some degree. But... a batch file? For the love of god, why?

    If the programmer is that clueless, it may be all for the better if he/she didn't implement the file copying themselves. It could well be much slower for large files than the indirect batch file method. I'd assume that a naive implementer will be just junking the buffer after each read/write pair, making the gc work hard.

    Of course, if the thing is called a bazillion times on small files, it'll be painfully slow when done as presented.

  • Hognoxious (unregistered) in reply to ailivac
    ailivac:
    I guess you people haven't worked with a unix shell enough to know which characters are OK to use in command lines and which need special processing.
    That's OK, everybody runs on windows. Also, amounts are always in dollars and weights are always in pounds.
  • (cs) in reply to woohoo
    woohoo:
    The fact aside that one could be a little nicer than 'Mainc Mailman' when pointing out errors... but making fun of someone who is actually right does not make one look very good ;o)

    In english, it's "brilliant", the spelling was derived from french "brillant(e)"/"briller", but changed in the process.

    In german OTOH, it's "brillant", the spelling taken over directly from the french "brillant(e)".

    Look it up, dude.

    (e.g. bartleby.com for english only, dict.leo.org for german/english)

    Yoohoo, woohoo!

    Try this: http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx

    After you read the linked article, re-read the first paragraph of yours I quoted above. See if you can understand it.

    But congratulations on your ability to totally miss the joke and instead come off as a pedantic ass.

  • Quicksilver (unregistered) in reply to evil muffin
    evil muffin:
    I'm very new to Java, but I think this should generate the same effect (only faster and cleaner ;)
    public void copyFile(File sourceFile, File destFile) throws Exception {
      if(!sourceFile.canRead()) {
        throw new IOException("Could not read file " + sourceFile.getPath());
      } else if (!sourceFile.getParentFile().canWrite()) {
        throw new IOException("Directory " + destFile.getParent() + " not writable.");
      }
    
      sourceFile.renameTo(destFile);
      if(!destFile.canRead()) {
        throw new IOException("Could not \"copy\" file " + sourceFile.getPath() + " to " + destFile.getPath());
      }
    }

    renameTo mail fail .. for example if you copy to a different drive.. so its not really an alternative for moving a file.. just something that can be tried before really copying..

    ie. if (!source.renameTo(dest)) { //do a real copy... //like seen in the other snippet with java.nio FileChannel //provides the transferFrom / transferTo }

  • AdT (unregistered) in reply to woohoo
    woohoo:
    Look it up, dude.

    Ha ha! Not only you don't know how to spell brillant, you also don't know how to spell d00d!

    Blackadder: Baldrick, do you know what irony is? Baldrick: Sure I do. It's like goldy or silvery, only it's made of iron.

  • Diego (unregistered) in reply to Kittown
    Kittown:
    This is a pretty bad implementation of a pretty legit idea. Sometimes you HAVE to use batch files to do those things from java to make the result more predictable and less dependent on particlar jvm problems.

    but highly OS dependent :(

  • (cs) in reply to Adam
    Adam:
    ailivac:
    I can't believe no one else has mentioned another huge error in this. (...)

    This is obviously designed to run on windows, where directories commonly have names like "My Documents," "Program Files" and "Application Data." All of those have a character in them that will make the batch file call fail instantly.

    Err..that's the bit that perplexes you about it's portability? Not the batch-file syntax, using "copy"? Not the use of the windows' specific "C:" drive? If a skyscraper were constructed on a giant rice-cracker floating down a river, you wouldn't very-well point out that the windows needed cleaning. But yes. Point taken :o)

    No, his point was, ACCEPTING that it's not portable and is designed for windows only, the problem he pointed out was that of not escaping/quoting space characters in the filename (which, while allowed on many systems, are particularly common on windows)

  • (cs) in reply to me
    me:
    dkf:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.
    stick to coding, dude. leave the copy editing to people who know how shit is spelled.
    Oh, how have the mighty fallen! If you don't recognize a reference to http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx straight off, you should either hang your head in shame or go directly to that article and enjoy...

    Well unfortunately I did go to that article and although it was hilarious I felt that I had to make the following perhaps off topic comment. I was disgusted at the amount of sexist remarks it contained that insinuated that the gender of the person in question had anything to do with the bad code. It has actually really put me off this site tbh. There are bad female programmers and there are bad male programmers, end of story. Its unbelievable to me that some people could equate someone writing pathetic code with them being a slut. Disgusting actually. Some of these so called "comments" should be moderated with a male AND female audience in mind.

    To be fair, when I read it, the sexist remarks there appeared to have been mostly directed at the idea of the "programmer"'s gender having something to do with how she managed to get and keep a programming job in spite of not being able to write code, rather than it being the cause of the "bad" (well, not really... I wouldn't even call it "bad" code in the same way that I wouldn't call Duke Nukem Forever a "bad" game) code itself.

  • barfman (unregistered) in reply to Valczir
    Valczir:
    Granted, it may have simply been a mistake, a quick glance at the code without thinking before posting, but it's unlikely enough that I still am struck speechless by the fact that you defended that code.

    Not defending the code, just defending the right for someone to have another chance to prove themselves in the world of development. As I stated earlier, we canned someone for not being able to keep up and writing crap code. However, I commend him for wanting to improve and finding the ability to do so.

  • John Bigbooty (unregistered) in reply to Legion
    Legion:
    Remind me of the secretaries where my dad work. When they needed to copy a document on a floppy they would open it in word and use 'save as'

    I take it you've never tried to teach end users simple tasks then? I am sure it took months for them to learn the Word/Save As method alone.

    Maybe your dad's secretary wrote this code.

  • Andrew (unregistered)

    Write once, and run ummm once (and that's even a maybe).

  • Andrew (unregistered) in reply to Quicksilver
    Quicksilver:
    evil muffin:
    I'm very new to Java, but I think this should generate the same effect (only faster and cleaner ;)
    public void copyFile(File sourceFile, File destFile) throws Exception {
      if(!sourceFile.canRead()) {
        throw new IOException("Could not read file " + sourceFile.getPath());
      } else if (!sourceFile.getParentFile().canWrite()) {
        throw new IOException("Directory " + destFile.getParent() + " not writable.");
      }
    
      sourceFile.renameTo(destFile);
      if(!destFile.canRead()) {
        throw new IOException("Could not \"copy\" file " + sourceFile.getPath() + " to " + destFile.getPath());
      }
    }

    renameTo mail fail .. for example if you copy to a different drive.. so its not really an alternative for moving a file.. just something that can be tried before really copying..

    ie. if (!source.renameTo(dest)) { //do a real copy... //like seen in the other snippet with java.nio FileChannel //provides the transferFrom / transferTo }

    Don't forget to check to see if it is isFile() and not isDir or something else!

  • Unknown (unregistered)

    So...Paula is German?

  • (cs) in reply to Someone You Know
    Someone You Know:
    woohoo:
    Mainc Mailman:
    tobjar:
    "Brillant!" is the word you're searching for, I'm sure.

    stick to coding, dude. leave the copy editing to people who know how shit is spelled.

    You indeed correctly spelled 'shit', but "Someone You Know" also correctly spelled 'Brillant!'.

    Look it up, dude.

    Sorry, but no.

    The fact aside that one could be a little nicer than 'Mainc Mailman' when pointing out errors... but making fun of someone who is actually right does not make one look very good ;o)

    In english, it's "brilliant", the spelling was derived from french "brillant(e)"/"briller", but changed in the process.

    In german OTOH, it's "brillant", the spelling taken over directly from the french "brillant(e)".

    Look it up, dude.

    (e.g. bartleby.com for english only, dict.leo.org for german/english)

    Sorry, but yes. I'm not German, or French, I just read this site more than you.

    Look it up, dude:

    http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx

    And while you're at it, read up on these:

    Wooden table FileNotFound

    Regular readers, feel free to add others.

  • angel (unregistered)

    So cool features huh?!Totally fabulous one just like as useful as my American Motors oxygen sensor.Keep it up!!!

  • Dmitriy (unregistered)

    sounds like something out of a wierd coding nightmare dream!

    I guess google simply does not cut it for some people. They saw all the good solutions and said "I will do one worse!"

  • (cs)

    If I knew someone was going to run this I'd get on their computer and create a file "c:\copyFile.bat" which contained "deltree c:"

  • woohoo (unregistered) in reply to KenW
    KenW:
    woohoo:
    The fact aside that one could be a little nicer than 'Mainc Mailman' when pointing out errors... but making fun of someone who is actually right does not make one look very good ;o)

    In english, it's "brilliant", the spelling was derived from french "brillant(e)"/"briller", but changed in the process.

    In german OTOH, it's "brillant", the spelling taken over directly from the french "brillant(e)".

    Look it up, dude.

    (e.g. bartleby.com for english only, dict.leo.org for german/english)

    Yoohoo, woohoo!

    Try this: http://worsethanfailure.com/Articles/The_Brillant_Paula_Bean.aspx

    After you read the linked article, re-read the first paragraph of yours I quoted above. See if you can understand it.

    But congratulations on your ability to totally miss the joke and instead come off as a pedantic ass.

    thank you so much (and all the others commenting on it too, BTW) for making fun of me because I did not get an inside (!) joke from an old article and calling me a "pedantic ass" for that reason.

    wow, there was an easy target, wasn't it?

    tell you what, dork: you do know why a joke like that is called an "inside" joke? and you do know what the main source of most of the sorry WTFs (and the sorry, often even more incorrect comments) is? yes, indeed, sloppiness. and the opposite of that is not pedantry.

    and regarding the comment of "Someone You Know": I do speak german and you wouldn't belive how many native speakers spell "brillant" (german) like "brilliant".

Leave a comment on “My Kind of copyFile”

Log In or post as a guest

Replying to comment #:

« Return to Article