Copy of a file

Hi,
How would I read a text file and write to another file a copy of that text file
      String pathName = " ";
      File originalFile = new File(pathName);
      String pathName2 = " ";
      File copyOfFile = new File(pathName2);
      BufferedReader bufferedFileReader = null;
      BufferedWriter bufferedFileWriter = null;
      try
         String currentLine;
         String cleanedLine;
         bufferedFileReader = new BufferedReader(new FileReader(originalFile));
         bufferedFileWriter = new BufferedWriter(new FileWriter(copyOfFile));
         currentLine = bufferedFileReader.readLine();
         while(currentLine != null)
      catch(Exception anException)
     

800800 wrote:
Hey, full code sure helps me.No it doesn't. It just teaches you to rely on others to solve your problems.
By the time I post a call for help, I'm desperate to fix the thing after having spent hours if not days bangin my head on the table and scouring the internet for tutorials and examples. I will work on it until I am at my wits end before finally submitting a post, and by that time, I just want that darned thing to work.Nevertheless, the correct way to address that is to find out what part of the concept is your sticking point, and clear up the confusion.
I presume that posting full code solutions means it doesn't help the OP to learn. Correct.
I'm good with that and agree, but in my case, when I resort to asking for help, I just need it to work. ;-)That's not helping you. If all you want is working code, then hire somebody to write code for you.
So... thanks for you guys. It would not be an understatement to say that you've occasionally help save my job!Jeepers. If somebody else is providing the code you're getting paid to write, I hope you're at least taking the time to study the handout so that you can do it yourself next time.

Similar Messages

  • Error 8062 when I try to copy or move files on my macbook: "This operation could not be completed because an unexpected error occurred (error code -8062)". Can even not install new software now!!

    Since a few days when I try to copy or move files on my macbook, I often get an error message saying "This operation could not be completed because an unexpected error occured (error code -8062)". And then it just quits the copy or move.
    I searched a lot on the internet, but only found solutions for cases you cannot empty the trash due to this issue.
    I tried those solutions for my trash and that helped after some trying.
    However, I still have the problem with copying and moving files.
    I even cannot install new software now, as it has to copy itself to the programs-directory, and gives the same error-message.
    Who can help me??
    Cannot seem to find any info on it on the support-forums or elsewhere.
    My user-account is administrator, I use a 13" Macbook Aluminium (Late 2008). Mac OS X 10.6.8 CPU 2Ghz Intel Core Duo, RAM: 4GB 1067 MHz DDR3.
    Any help would be greatly appreciated...
    Otto

    Tips I received so far (thanks to A-Mac via Twitter http://www.a-mac.nl and Remco Kalf http://www.remcokalf.nl/)
    - make sure you have at least 10% of your harddisk in free space (I had only 5%).
    - do a PRAM-reset (http://support.apple.com/kb/ht1379)
    - perform a hardware test (http://support.apple.com/kb/HT1509)
    - make a complete backup (with for example Carbone Clone Copier, see http://www.bombich.com/)
    - after complete backup: use diskwarrior (boot from Diskwarrior DVD, first perform diagnostics, then perform "Rebuild" which rebuilds your file directory).
    So far I only cleared up some space on my HD, and already the problem occurs less.
    Still, I will go through the other tips too.
    (will post progress)

  • I backup my iphone on my pc and copy backup file into drive D then i setup new OS on my pc. after that i copy the backup file into itunes backup folder but itunes can't find the backup file to restore my iphone. how can i restore my iphone?

    i backup my iphone on my pc and copy backup file into drive D then i setup new OS on my pc. after that i copy the backup file into itunes backup folder but itunes can't find the backup file to restore my iphone. how can i restore my iphone?

    Don't you just love changes in interfaces?
    I found the answer to my question.
    When you attach a device (iPhone, iPad) to your Mac, in iTunes 12 in appears as a tiny icon in the second "row" of the iTunes display. Click the icon and the familiar iTunes display for the device appears. From there, on the Summary screen, you can see the dates of the backups of the device (iCloud and backup to the computer). You can also use the button to backup to the computer.

  • I can't get download to work - it will not copy the mp3 file to my chosen location (as set in tools/options) - it gives me a new window with a player - no dwnlo

    I am running windows xp sp2 and I have set my dowload location under (tools/options), but when I select an MP3 file to download, firefox does NOT copy the file to my chosen location on my HD - instead, it opens up a new window with a makeshift "player" and begins loading the player with the MP3 file. The problem is that I have no idea where on my system firefox has copied this file to, so, I cannot leave and come back later and play this MP3 file using winamp. I have to listen to it right then or lose it - if I close that new window (with that puny little "player"), then I lose the download, wherever firefox put it on my PC (I got no idea where it is). This is all under firefox 25.0
    I am also running FIrefox 12.0 on an older windows 2000 machine and that works perfectly - I can download any MP3 file I want, and firefox 12.0 (on win2k, sp4) downloads it to my chosen location (on my HD), and it gives me the download window so I can watch its progress and have some control over pause, and resume, and, when it is done, the download window offers me the option to "open containing folder" so I can make sure it got to where I wanted it. In other words, Firefox 12.0 on WIn2k, sp4 works better than firefox 25.0 on winxp sp2!!!!! What gives? I went through and set up my options for XP just like I did with Win2k and it all looks good, but firefox 25.0 just ignores my chosen location and always defaults to give me that makeshift player and I am not able to actually copy the mp3 file to my harddrive - it makes firerox 25.0 almost unusable since downloading mp3 files is a big part of my firexfox use - please help - I am not able to upgrade windows at this time, and, since firefox 12.0 still works fine on win2k, I can't understand what happened at firefox?

    Phillipp,
    I tried it again using "save link as", and this time it actually worked! I just now downloaded several more using the "save link as" option, and it works perfectly. Thanks. Problem solved.
    Littleberry

  • HT2548 how do i copy the domain file from OS 10.4 to a lion OS computer?  I made a copy of the domain file and copied it to my new computer, but it doesn't open in iweb when I double-click on it.

    How do I import an iweb domain file from an ibook (OS 10.4) to an imac (OS 10.73)?
    I copied the domain file from my ibook to my imac, but when I double-click on the file, it doesn't open in iweb. 

    In Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.  Then place the domain file in your Users/Home/Library/Application Support/iWeb folder.
    To open your domain file in Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • How to Copy an Image File from a Folder to another Folder

    i face the problem of copying an image file from a folder to another folder by coding. i not really know which method to use so i need some reference about it. hope to get reply soon, thx :)

    Try this code. Make an object of this class and call
    copyTo method.
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class FileUtil
    extends File {
    public FileUtil(String pathname) throws
    NullPointerException {
    super(pathname);
    public void copyTo(File dest) throws Exception {
    File parent = dest.getParentFile();
    parent.mkdirs();
    FileInputStream in = new FileInputStream(this); //
    Open the source file
    FileOutputStream out = new FileOutputStream(dest); //
    Open the destination file
    byte[] buffer = new byte[4096]; // Create an input
    buffer
    int bytes_read;
    while ( (bytes_read = in.read(buffer)) != -1) { //
    Keep reading until the end
    out.write(buffer, 0, bytes_read);
    in.close(); // Close the file
    out.close(); // Close the file
    This is poor object-oriented design. Use derivation only when you have to override methods -- this is just
    a static utility method hiding here.

  • Time Machine only shows the current copy of the file I am trying to restore. There is none of the time machine backup histories shown. I am running OSX 10.7.5. I see the backup files on my external Time Machine hard drive. Help

    Time Machine only shows the current copy of the file I am trying to restore. There is none of the time machine backup histories shown. I am running OSX 10.7.5. I see the backup files on my external Time Machine hard drive in the Backups.backupdb folder.
    Time Machine does show the history of my Macintosh HD, but when I try to navigate to the folder I wish to restore the backup history disappears. I've been searching for answers and I have not found one that works for me.

    Time Machine only shows the current copy of the file I am trying to restore. There is none of the time machine backup histories shown. I am running OSX 10.7.5. I see the backup files on my external Time Machine hard drive in the Backups.backupdb folder.
    Time Machine does show the history of my Macintosh HD, but when I try to navigate to the folder I wish to restore the backup history disappears. I've been searching for answers and I have not found one that works for me.

  • Error 1003 occurred at Open VI Reference in Dist Copy Non-VI Files.vi- Dist Build LLB Image.vi- Dist Build App Image.vi- Build Application.vi

    When trying to build  an application using labview 7.1 and windows XP,  I get the error
    Error 1003 occurred at Open VI Reference in Dist Copy Non-VI Files.vi->Dist Build LLB Image.vi->Dist Build App Image.vi->Build Application.vi
    I've tried the crtl-shift-run as well as  a mass compile and I still get the error.
    Any ideas?
    Thanks,
    Mike

    Hopefully this thread, or this KB article might help.
    It seems like this could come from a lot of things, but there's suggestions in those which might lead you in the right direction
    Message Edited by Day on 09-22-2006 02:07 PM

  • How do I stop Dreamweaver from updating the Test server copy of a file when I open the local file?

    The subject says it all. Every time I open a file, Dreamweaver connects to the testing server and uploads the local file to the test server.
    I want to stop this behaviour.  It's annoying!

    My testing server is IIS running on my local machine.
    The "local" copy of the file is actually on a remote share.  I have the test server copy open in Notepad++.  The two files are identical save for on extra line in the copy on the testing server.  When I open the "local" copy in Dreamweaver, it shows me that some file activity is being done, and then Notepad++ tells me the file has changed and do I want to reload it.  If I do, that extra line vanishes.
    When I check the file activity log, it shows that the file activity is complete.
    I haven't mentioned the production server because it doesn't seem to be affected, but we do have one.

  • Is a copy of .xml file on the iPod too? If so, how can I copy ONLY the .xml file to my computer and NOT have to copy all my music files too?

    I had to re-load my OS (Windows XP Pro) from a HD snapshot via Acronis True Image Server. I save my OS on my C: drive and all my data files on my D: drive.  So when I re-loaded my OS, I still have all of my music files intact.
    I have re-loaded the OS before and had to re-create iTunes library which I did by doing the follwing:
    1. cut & paste .xml file in iTunes folder to desktop
    2. delete .itl file in iTunes folder
    3. import .xml file through iTunes  file>library>iport playlist
    4. navigate to .xml file on desktop and import
    This worked last time I re-loaded my OS but not this time for some reason.
    So I'm wondering if there is a copy of the .xml file on the iPod itself in the iPod_Control folder that I can copy and paste to my comuter desktop and import via the above steps?
    I have seen all kinds of solutions on the web that include copying the music files from the iPod to the computer.  I don't need to do that.  I have the music files.  I just need the .xml file so iTunes can talk to my iPod (5th Generation - 30G).

    Backup your music library, that is the only way to ensure it does not go missing through theft, damage, operator error, machine breaks, upgrades go wrong, operator goes wrong .........

  • Can I copy a Backup file from one PC to another and use it?

    IPhone got all screwed up with the update on my home PC and wont restore, my PC at work does it fine, but my backup file is on my home PC. Can I copy my Backup file from my home PC and put it on my work PC to restore my IPhone?

    Before your restoring your iPhone with your PC at work, you can create a backup of your iPhone on the PC before restoring.
    With your iPhone connected and available in the iTunes source list, control click on your iPhone and select Back Up.

  • How can I copy a backup file from one computer to another?

    I want all of my app date, music, videos, ect to be on a new computer. Is it possible to back up my iPod Touch 3g on my old computer and copy the backup file onto the new computer? If so, how?

    Before your restoring your iPhone with your PC at work, you can create a backup of your iPhone on the PC before restoring.
    With your iPhone connected and available in the iTunes source list, control click on your iPhone and select Back Up.

  • I was able to copy all my files from my Time Capsule, but that is all they are...files. How do I get my new Mac Mini to emulate my other Mac?

    I was able to copy all my files from my Time Capsule, but that is all they are...files. How do I get my new Mac Mini to emulate my other Mac?

    Doggiemommie,
    Copying files is not a good idea.
    The "other Mac" was backed up onto Time Capsule using the Time Machine. On your new Mac you should restore the old user - rather than copy files manually.
    This usually happens during the initial setup of the new computer or you can do it later using Migration Assistant.
    Please note, it is possible to damage backup file on the Time Capsule when you browse it and copy files manually.
    Hope this explains.
    TZ

  • How do I copy my video files from iPhoto to iMovie. The two   hour wait to view all in iMovie puts the kibosh on my edit time.

    How do I copy my video files from iPhoto to iMovie? The two + hour wait for thumb nails and hour long wait looking for the right videos kills the time I have to edit.

    You need to convert the VOB files in the TS-Folder of the DVD back to DV which iMovie is designed to handle. For that you need mpegStreamclip:
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    which is free, but you must also have the  Apple mpeg2 plugin :
    http://www.apple.com/quicktime/mpeg2/
    (unless you are running Lion in which case see below))
    which is a mere $20.
    Another possibility is to use DVDxDV:
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm
    which costs $25.
    For the benefit of others who may read this thread:
    Obviously the foregoing only applies to DVDs you have made yourself, or other home-made DVDs that have been given to you. It will NOT work on copy-protected commercial DVDs, which in any case would be illegal.
    If you are running Lion:
    From the MPEG Streamclip homepage
    The installer of the MPEG-2 Playback Component may refuse to install the component in Lion. Apple states the component is unnecessary in Lion, however MPEG Streamclip still needs it.
    To install the component in Lion, please download MPEG Streamclip 1.9.3b7 beta above; inside the disk image you will find the Utility MPEG2 Component Lion: use it to install the MPEG-2 Playback Component in Lion. The original installer's disk image (QuickTimeMPEG2.dmg) is required.
    The current versions of MPEG Streamclip cannot take advantage of the built-in MPEG-2 functionality of Lion. For MPEG-2 files you still need to install the QuickTime MPEG-2 Playback Component, which is not preinstalled in Lion. You don't have to install QuickTime 7.

  • I converted aif files to mp3 files in I tunes so I could put them on a flash drive.  Now when I transfer an album to the flash drive I get both the aif files and the mp3 files in the flash drive.  How do I get the iTunes to only copy the smaller file?

    I converted aif files to mp3 files in iTunes so I could put them on a flash drive.  Now when I transfer an album to the flash drive I get both the aif files and the mp3 files on the flash drive.  How do I get the iTunes to only copy the smaller file?

    My suggestion to use the smart playlist was more along the lines of making one list with rules to show everything in your library as long as it was kind "mpeg" (= mp3).
    Smart playlists cannot be edited manually, only by changing the rules.  You can use them as the basis for another smart playlist though.
    There is added overhead to using smart playlists, so don't go overboard.

  • How can I copy all the files from my iMac to an external drive so they remain as 'regular accessible files'? I want to clean my dive

    How can I copy all the files from my iMac to an external drive so they remain as 'regular accessible files'? I want to clean my dive

    You can use a program like Carbon Copy Cloner.  It will clone your HD to the external.  The format is the same as your internal drive and you can boot from it using Option key at boot time.
    http://www.bombich.com/
    Regards,
    Captfred

Maybe you are looking for