Using jdk1.3.1 to transfer files/folders from one directory to another

I am writing a simple program to transfer files and folders from one directory to another
For example, I have some files and folders in C:\send\ directory.
I want to know how to move them to C:\receive\ directory.
Can someone please tell me which class I should use and which method?
I need to complete this urgently.
Thanks.
Deeply appreciate it.

not very difficult. You should use the File class and the "renameTo" method.
Example:
  File origin = new File("c:\\lost\\myFile.zer");
  File dest = new File("c:\\found\\myFile.zer");
  origin.renameTo(dest);Of course you have to take care that the file doesn't exists previously, etc. But i think that all you need is in the File class.
Hope this helps.
Zerjio

Similar Messages

  • HT2518 transfer files, applications from one mac to another mac

    Whst is the best way to move files and applications from one mac to another?

    How to use Migration Assistant:
    http://support.apple.com/kb/HT4413?viewlocale=en_US
    http://support.apple.com/kb/TS1963
    Troubleshooting Firewire target disk mode:
    http://support.apple.com/kb/HT1661

  • How to move folders from one server to another serve using unix command

    Hi All,
    How to move the folders from one server to another server using unix command.
    scp -r armops@sjarmprd01:/ARM/scripts [email protected]:/ARM/scripts/
    but it is giving an error like not a regular file .. what it means .. please let me know if any one knows about it
    Thanks
    Sreedhar

    not a regular file .. what it meansProbably you have some fifo (named pipe) files...
    Said that this has nothing to do with database (you should post on some nix forum, for example http://forums.oracle.com/forums/forum.jspa?forumID=135), you may try rsync* command (man rsync).

  • How do you transfer Apple IDs from one ipad to another iPad?  I got the new ipad and gave my ipad 2 to my wife who had the first version and now I can't get my Apple ID off so she can use her Apple ID.

    how do you transfer Apple IDs from one ipad to another iPad?  I got the new ipad and gave my ipad 2 to my wife who had the first version and now I can't get my Apple ID off so she can use her Apple ID.

    You don't transfer Apple ID's from one device to another one. You sign out in the settings, )the App Store and iTunes if necessary) and then sign in with the other ID.
    Settings>iTunes & App Stores>Apple ID>Sign out. Them sign in with the other ID. You can sign out of the app store and iTunes as well by going to the featured Atab in the App Store and the music tab in iTunes, swipe to the bottom and access the Apple ID in there.
    You should have erased the iOad before you gave it to her in Settings>General>Reset>Erase all content and settings. That way she could set up the iPad as new with her own Apple ID.
    Be aware of the fact that if you use each others ID's in order to download past purchased content to your own iPads, you will lock yourself out of your own ID as you will have associated your iPad with the other person's Apple ID.
    In other words, if you sign into your wife's ID on your iPad so that you can download an app or an album so that you don't have to pay for it again, you will lock yourself out of your Apple ID for 90 days.

  • How to Transfer the iPhone from one computer to another Win XP

    All
    I got my wife a new macbook pro, running Windows XP prof. She has an iphone 3G with 16 GB memory running 3.0.1. So..she wanted to transfer the sync function from her PC to her macbook. Of course, Apple was of NO help at all (but did want to charge us $69.95 since her iphone is out of warranty, and this was an iphone not a mac problem, hmmm..). Took me lots of digging, but here is how you transfer you iphone from one computer to another:
    1. Move you itunes library from the old computer to the new one. To do this, you do NOT just copy it. This is as good a link to use as any to see how to do it, but search the internet and you can find instructions:
    http://reviews.cnet.com/8301-12519_7-10242259-49.html
    2. Transfer your applications you have purchased to the new computer. To do this, open itunes in the new computer, hook up your phone and click on File>transfer purchases (from itunes store) to computer. This will move your applications to the new computer.
    3. Export your MS outlook calendar, contacts, notes, etc. to the new computer by saving each of these categories as a PST file (file>export>then choose the category and type of file)...and then copy these PST files to your new computer and import them into MS outlook.
    4. Copy your playlists from itunes on your old computer to your new computer. This link may be helpful or search the internet again if you need to:
    http://osx.tribe.net/thread/08fd0e5e-f1d0-450b-8de5-9f7cb5bd278d
    5. Now...the important part...how to transfer all your settings from the iphone to the new computer....this is the part that was hard to find online, but finally got it: NOTE: THE BACKUP THAT ITUNES MAKES BACKS UP THE APPLICATION SETTINGS BUT NOT THE APPS SO THIS IS WHY YOU NEED TO TRANSFER THE APPS TO THE NEW COMPUTER. The settings have all the data you put into your apps, email settings, preferences, etc...so its a huge time save to transfer these to the new computer also.
    -Sync your iphone with your old computer to have a backup in case you mess up...in that case you can restore from your old computer and start over
    -Plug your iphone into the new ocmputer and start itunes. It will detect your phone (I assume you have already authorized your new computer to use the library and playlists and apps that you moved)
    -Right click on the "iphone" on the left bar...you will see a popup menu...click on "BACKUP". Let it backup your iphone to the new computer. It will NOT sync the phone
    -When the backup is done....copy the backup file to a temp directory to be safe. The backup is located in "documents and settings">user name>applications>apple computer>mobile sync. If you cannot see it, you need to open windows explorer (not internet explorer) and go to tools>folder options>view and click on "show hidden files and folders" Note YOU CANNOT JUST COPY THE BACKUP FROM THE OLD COMPUTER TO THE NEW COMPUTER AS SUGGESTED ON SOME WEB SITES...THIS DOES NOT WORK, ITUNES WILL NOT IDENTIFY THE BACKUP EVEN IF YOU PUT IT IN THE FOLDER IN THE NEW COMPUTER THAT MIRRORS THE FOLDER LOCATION IN THE OLD COMPUTER.
    -OK now you are ready...click restore on the iphone and restore the phone to factory settings. This will happen in a few minutes (10-15 mins).
    -The phone will reboot and itunes will recognize the phone again...as a restored phone. It will then ask you if you want to restore it from the backup..say YES. You then need to go through all the itunes tabs and click on everything you want to sync to the phone (playlists, movies, podcasts, ringtones, etc). Once you are done going thru the tabs click "apply" and the sync will start. Go out, to a movie, to bed, whatever because it will take hours to sync.
    -Once the sync is done...voila...your iphone has been moved with ALL the settings to the new computer. Check it. Then you can delete the backup you put into the temp folder if it is OK
    -Deauthorize your old computer
    This worked for Win XP...should work for Vista. The whole process took many hours so don't rush through it (i'm guessing 12 hours total work).
    Can I send apple a bill for tech support?????

    All
    I got my wife a new macbook pro, running Windows XP prof. She has an iphone 3G with 16 GB memory running 3.0.1. So..she wanted to transfer the sync function from her PC to her macbook. Of course, Apple was of NO help at all (but did want to charge us $69.95 since her iphone is out of warranty, and this was an iphone not a mac problem, hmmm..). Took me lots of digging, but here is how you transfer you iphone from one computer to another:
    1. Move you itunes library from the old computer to the new one. To do this, you do NOT just copy it. This is as good a link to use as any to see how to do it, but search the internet and you can find instructions:
    http://reviews.cnet.com/8301-12519_7-10242259-49.html
    2. Transfer your applications you have purchased to the new computer. To do this, open itunes in the new computer, hook up your phone and click on File>transfer purchases (from itunes store) to computer. This will move your applications to the new computer.
    3. Export your MS outlook calendar, contacts, notes, etc. to the new computer by saving each of these categories as a PST file (file>export>then choose the category and type of file)...and then copy these PST files to your new computer and import them into MS outlook.
    4. Copy your playlists from itunes on your old computer to your new computer. This link may be helpful or search the internet again if you need to:
    http://osx.tribe.net/thread/08fd0e5e-f1d0-450b-8de5-9f7cb5bd278d
    5. Now...the important part...how to transfer all your settings from the iphone to the new computer....this is the part that was hard to find online, but finally got it: NOTE: THE BACKUP THAT ITUNES MAKES BACKS UP THE APPLICATION SETTINGS BUT NOT THE APPS SO THIS IS WHY YOU NEED TO TRANSFER THE APPS TO THE NEW COMPUTER. The settings have all the data you put into your apps, email settings, preferences, etc...so its a huge time save to transfer these to the new computer also.
    -Sync your iphone with your old computer to have a backup in case you mess up...in that case you can restore from your old computer and start over
    -Plug your iphone into the new ocmputer and start itunes. It will detect your phone (I assume you have already authorized your new computer to use the library and playlists and apps that you moved)
    -Right click on the "iphone" on the left bar...you will see a popup menu...click on "BACKUP". Let it backup your iphone to the new computer. It will NOT sync the phone
    -When the backup is done....copy the backup file to a temp directory to be safe. The backup is located in "documents and settings">user name>applications>apple computer>mobile sync. If you cannot see it, you need to open windows explorer (not internet explorer) and go to tools>folder options>view and click on "show hidden files and folders" Note YOU CANNOT JUST COPY THE BACKUP FROM THE OLD COMPUTER TO THE NEW COMPUTER AS SUGGESTED ON SOME WEB SITES...THIS DOES NOT WORK, ITUNES WILL NOT IDENTIFY THE BACKUP EVEN IF YOU PUT IT IN THE FOLDER IN THE NEW COMPUTER THAT MIRRORS THE FOLDER LOCATION IN THE OLD COMPUTER.
    -OK now you are ready...click restore on the iphone and restore the phone to factory settings. This will happen in a few minutes (10-15 mins).
    -The phone will reboot and itunes will recognize the phone again...as a restored phone. It will then ask you if you want to restore it from the backup..say YES. You then need to go through all the itunes tabs and click on everything you want to sync to the phone (playlists, movies, podcasts, ringtones, etc). Once you are done going thru the tabs click "apply" and the sync will start. Go out, to a movie, to bed, whatever because it will take hours to sync.
    -Once the sync is done...voila...your iphone has been moved with ALL the settings to the new computer. Check it. Then you can delete the backup you put into the temp folder if it is OK
    -Deauthorize your old computer
    This worked for Win XP...should work for Vista. The whole process took many hours so don't rush through it (i'm guessing 12 hours total work).
    Can I send apple a bill for tech support?????

  • How can i transfer my music from one account to another on a different computer?

    So i have an itunes account on dell laptop and i share that account with other famliy members. I recently bought a mac pro and wanted to create a new account that way i can use icloud, is there any possible way to transfer everything from my old library to my new one or will i lose everything i had on my phone and ipods? Or is it possible to have one account but multiple icloud accounts?

    lisafromwindermere wrote:
    I want to start my own account separate from my parents. Can I transfer my music from one account to another? If so, how?
    Lisa,
    Just get copies of the song files and add them to your iTunes library.  With the exception of any DRM-protected files (purchased before mid-2009 and never upgraded) they will play fine, even though they are technically associated with the original account.

  • Can i transfer my backup from one laptop to another?

    I have my backup of apps and music stored in one laptop's iTunes account, how can I transfer my backup from one laptop to another?

    iTunes downloads are not stored in a backup (that contains documents, files, camera roll photos, app content/settings etc), neither are the contents of the device's Music and Videos apps - instead a restore would look to pick up your music, films, apps etc from your iTunes library.
    Your backups are stored under :
    Mac: ~/Library/Application Support/MobileSync/Backup/
    The "~" represents your Home folder. If you don't see Library in your Home folder, hold Option and click the Go menu.
    Windows Vista, Windows 7, and Windows 8: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    To quickly access the AppData folder, click Start. In the search bar, type %appdata%, then press Return.
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    To quickly access the Application Data folder, click Start, then choose Run. In the search bar, type %appdata%, then click OK.
    You will need to copy the entire backup directory and copy it into the relevant directory on your other laptop - it should then automatically be picked up by that computer's iTunes and show on the Devices tab in Edit > Preference (iTunes > Preferences on a Mac) on it.
    To copy your iTunes library between computers : How to move your iTunes library to a new computer.
    You can also use home sharing to copy content between computers : iTunes: Setting up Home Sharing on your computer.

  • How to transfer printer settings from one Mac to another (both OSX)?

    Hello, I have not found a detailed description on how to transfer printer settings from one Mac to another.
    My issue is that I have a Mac G5 with 3 different settings saved as "presets" for the same printer. This works great, since the posters I print (on the large format printer) need different margins and different paper at times.
    This G5 is basically retired and only used for printing. G5 has OSX 10.3.9
    I have a MacPro as its replacement (OSX 10.4.11).
    The MacPro has all my apps and other settings setup to my liking.
    I found several links via Google saying copy this folder or directory, but I am not sure I did it correctly. I don't see the "presets".
    I tried launching the Migration Assistant (I hope that's the correct name), but was concerned the settings on the new MacPro would be overwritten with ALL the old stuff on the older G5. I did not start the transfer process because of this.
    If someone would list the steps needed to accomplish the transfer of printer settings or advise if this is possible, then I would be very grateful! The previous user of the G5 I am using was a "Genius" and I don't know how he created these "preset" choices.
    Thanks!

    Hi SCChelpdesk, and a warm welcome to the forums!
    I found several links via Google saying copy this folder or directory, but I am not sure I did it correctly. I don't see the "presets".
    This is the File that holds that info on Tiger, not certain on Panther...
    /Users/YourUserName/Library/Preferences/com.apple.print.custompresets.plist
    After moving, you very well might have to change the Owner's Permissions within Get Info window, then log out/in.
    I tried launching the Migration Assistant (I hope that's the correct name), but was concerned the settings on the new MacPro would be overwritten with ALL the old stuff on the older G5. I did not start the transfer process because of this.
    MA would transfer the info, but/and, if the user that had that info had the same Shortname as on the new one, it'll demand you give it a new Shortname to use... but then those settings would be transferred to that new user on the new machine. I think the 1st one will work though.
    The previous user of the G5 I am using was a "Genius" and I don't know how he created these "preset" choices.
    We can go through that way if you like... not all that hard.

  • From Forms 5.0 I want to copy a file/folder from one location to another.

    Hi,
    I have a question and I really appreciate your help.
    My Question is
    I would like to copy a file/folder from one location to another.
    (For ex: From my Hard disk to a Network folder).
    I want to do this from Oracle Forms 5.0 and my operating system is Windows 2000/NT Workstation.
    At present my users are doing this by using drag and drop windows functionality,
    But now they want to do this by using a GUI screen.
    I would greatly appreciate if somebody can answer my question.
    Thank you very much and have a nice day.
    Thanks & Regards
    Sanjeev.

    Hi Shay,
    Am able to copy the files/folders by doing the follwing.
    Declare
    My_Command Varchar2(1000);
    Begin
    MY_COMMAND := 'XCOPY /E ' ||:FROM_LOC ||' '|| :TO_LOC ;
    HOST(MY_COMMAND);
    End;
    But my problem is am not able to trap the errors.
    Do you have any idea?
    Thanks

  • Java Program to copy file from one directory to another failing

    Hello All,
    Oracle Applications 12.1.3
    RDBMS: 11.2.0.30
    SQL*Plus: 10.1.0.5.0
    Java beginner here so help is much appreciated.  I'm have some java code that I'm using to copy a file from one directory to another in an Oracle Applications Server.  I notice that when moving to a new instnace I started to get file not found errors.  I think it's because of the directory.  My question is, does the directory in which I trying to pick up the file have to be a DBA_DIRECTORY, or a UTL_FILE directory in order for the java to find the file and move it?
    Here is my code...
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "COPY_FILE_JVS" AS
    import java.io.*;
    public class COPY_FILE_JVC{
      public static void copy(String SourceFile, String DestDir) {
        File source = new File(SourceFile);
        File dest = new File(DestDir);
        File cpDestFile = null;
        try {
          if (dest.isDirectory()) {
              if(source.isFile()) {
                System.out.println("File name = " + source.getName());
                System.out.println("File name dest = " + dest.getPath() );
                System.out.println("File name cpDestFile = " + dest.getPath() + File.separator + source.getName());
                cpDestFile = new File(dest.getPath() + File.separator + source.getName());
              else {
                System.out.println("Directory or File Not Found");
                return;
          BufferedInputStream  br = new BufferedInputStream (new FileInputStream (source));
          BufferedOutputStream  bw = new BufferedOutputStream (new FileOutputStream (cpDestFile));
          int read = 0;
          while((read = br.read()) != -1) {
            //System.out.println((char)read);
            bw.write(read);
          br.close();
          bw.close();
        catch (FileNotFoundException e) {
        e.printStackTrace();
        catch (IOException e) {
        e.printStackTrace();

    I get these messages when calling the java from SQL Plus as follows...
    serveroutput on size 100000;
    dbms_java.set_output(1000000);
    MY_PKG.CopyFile('/home/my_user/set_env.sh','/interface/home'); (this is call to oracle pl/sql package which calls the java.)
    PL/SQL procedure successfully completed.
    Directory or File Not Found
    PL/SQL procedure successfully completed.
    If I change the directory from /home/my_user/ to any directory that is defined in DBA_DIRECTORIES or is a UTL_FILE directory to program works.  Is it perhaps because the java is in a PL/SQL package as seen below?  The PL/SQL program runs as the APPS user and I have issued the following the command grant JAVASYSPRIV to APPS.
    Here is the PL/SQL Package....
    CREATE OR REPLACE PACKAGE BOLINF.MY_PKG AUTHID CURRENT_USER AS
    CopyFile(p_SourceFile IN VARCHAR2, p_DestDir IN VARCHAR2);
    +++++++++++++++++++++++++++++
    CREATE OR REPLACE PACKAGE BODY BOLINF.MY_PKG  is
    CopyFile(p_SourceFile IN VARCHAR2, p_DestDir IN VARCHAR2)
    AS LANGUAGE JAVA NAME 'COPY_FILE_JVC.copy(java.lang.String, java.lang.String)';

  • How do I transfer my music from one account to another

    I'm trying to figure out how t transfer my music from one account to another since someone hacked into my girlfriends account and now iTunes locked her account as a one account use only and majority of my music was bought with my card. Is there any way to transfer all my purchased music into my new account? I still have the music I purchased on my pc.

    You can't, all content is tied to the account that purchased / downloaded it and it can't be copied or transferred to a different account.

  • I want to start my own account separate from my parents. Can I transfer my music from one account to another? If so, how?

    I want to start my own account separate from my parents. Can I transfer my music from one account to another? If so, how?

    lisafromwindermere wrote:
    I want to start my own account separate from my parents. Can I transfer my music from one account to another? If so, how?
    Lisa,
    Just get copies of the song files and add them to your iTunes library.  With the exception of any DRM-protected files (purchased before mid-2009 and never upgraded) they will play fine, even though they are technically associated with the original account.

  • How do i transfer iTunes money from one account to another

    how do i transfer iTunes money from one account to another? also forgot security question answers

    You can't, an account's balance cannot be transferred to another account, nor can it be used to gift content to another account - it can only be used to buy content for the account that it's on.
    For your security questions, if you have a rescue email address (which is not the same thing as an alternate email address) on your account then you can use that to reset them : http://support.apple.com/kb/HT6170
    If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will have to contact Support in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    If your country isn't on that page then try this form and explain and see what they reply with : https://ssl.apple.com/emea/support/itunes/contact.html
    When they've been reset, and if you don't already have a rescue email address, you can then add one for potential future use : http://support.apple.com/kb/HT5620
    Or, if it's available in your country, you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • Move mail folders from one mac to another

    How to move my mail folders from one mac to another.
    The foldera re on my mac. See below the attached image.

    Some possible options in no particular order:
    (1) Copy the folders to a SUB Thumb Drive.
    (2) Use Dropbox
    (3) If your Macs are compatible with AirDrop see list:
    MacBook Pro (Late 2008 or newer)
    MacBook Air (Late 2010 or newer)
    MacBook (Late 2008 or newer)
    iMac (Early 2009 or newer)
    Mac Mini (Mid 2010 or newer)
    Mac Pro (Early 2009 with AirPort Extreme card, or Mid 2010)
    Activate AirDrop on both Macs to Move/Copy your Mail Folders.

  • How do i move a file from one directory to another?

    Can anyone help me in moving a file from one directory to another?
    The following code just does not work!!
    File source_file = new File(source_file);
    if(source_file.exists())
    File dest_file = new File(destination_file);
    if(!dest_file.exists())
    boolean moved = source_file.renameTo(dest_file);
    System.out.println("moved.."+moved);
    The varirable moved is always false.
    Can anyone tell me whts wrong in this code?

    The problem in your code is you used file object as argument when you create a new File. I changed a little bit codes and it should be fine now.
    String source_file1="test111.txt";
    String destination_file1="test222.txt";
    try{
         File source_file = new File(source_file1);
         if(source_file.exists())
              File dest_file = new File(destination_file1);
              if(!dest_file.exists())
                   boolean moved = source_file.renameTo(dest_file);
                   System.out.println("moved.."+moved);
    catch(Exception e){
               e.printStackTrace();
    }

Maybe you are looking for

  • Problems with controls after upgrading to ipod version 1.1

    i just downloaded new software for my ipod shuffle (version 1.1) and now my earbud control does not seem to be working (no volumne control, no forward or reverse - no control whatsoever). it was working fine before i connected to charge the unit. i w

  • My iphone photos do not show in my photostream

    hi, in the last few days, when I've taken photos with my iPhone (4S), they show in my camera roll but no longer appear in my photostream, so they are not shared to my iPad or Macbook Pro.  My phone is uptodate and running iOS 6.0.1.  I've not changed

  • Zero balance Splitting Method

    Dear all : when the GL Entry have many profit center in Dr. side any many Profit center in Cr. side the system split the zero balance in wrong way example PK                   Accc                Description                 Amount                    

  • How to view youtube videos from iphone 4 to tv using composite AV cable

    Hi, Can any one please help me as to how to view youtube online videos on TV through my iphone 4. I tried connecting the iphone 4 and TV with a composite AV cable however I can hear only the audio but am not able to view the videos.

  • Photoshop Touch 1.6 Fonts

    Hi All, I have just installed the new update to Photoshop Touch. 1.6 The New Brush engine is excellent and a lot better then before (looking forward to more brushing being added) However the problem I have is the Fonts. The update states that can now