Copy a file from local drive to network drive!

The subject says it all but I'll explain. I have a web application that runs on a tomcat and mysql. I have a bunch of clients in a local network that uses the application.
Server is running Windows 2003 server and clients are running windows XP.
On a client request a file is created on the server in "temp" folder. The file name is "justAFile.txt".
On the client pc a folder "temp" is shared for reading/writing.
What I want is the server to take the IP address of the client, and then based on that address to copy the file "justAFile.txt" to it (for example "\\192.168.0.20\temp\" - that is the client address).
I have the address of the client:
String userAddress = request.getRemoteAddr();I use this code:
FileOutputStream outFile;
PrintStream p;
String bonFileName = (justAFile.txt");
String destinationFileWithPath = ("\\\\192.168.0.20\temp\\skladPrint\\"+bonFileName);
try {
    outFile = new FileOutputStream(destinationFileWithPath);
    p = new PrintStream( outFile );
    p.println ("a textto be written on a file");
    p.close();
} catch (Exception e) {
     %>Error writing to file<br><%
}This code can create a file on a local drive with no problems, but when I try on a network drive it fails. Even for testing purposes I set the shared folder to a maped drive "Z:", and again no luck.
I've spend all my day till now in reading articles in inet, but haven't found one that will solve the problem.
I also tried creating a batch file (exec.bat) that has in it:
move \temp\*.txt \\192.168.0.20\temp
and then executing it with:
String[] executeCommand1 = { "cmd.exe", "/c", "\\temp\\exec.bat" };
Process p1 = Runtime.getRuntime().exec(executeCommand1);
p1.waitFor();But again no luck. When I execute the file from command prompt, it moves the file to the shared folder, but when I start it from the java application with the posted code, it DOES NOT move the file...
Any help will be appreciated...

Try using the jCIFS project. This package allows you to access shared folders on a PC if you have a good username/password.

Similar Messages

  • Load of file from a windows 2003 network drive failed

    Hello,
    I working on a windows 2003 Server machine with a Oracle database 10.2.0.3.
    I must automate a database task that consist in reading tow files from a network drive, load it on database and making some processing on loaded data
    I defined entities for use of scheduler but when job with this processing is run it doesn't complete it work
    In column additional_info of table user_scheduler_job_run_details I have found this message
    CHAIN_LOG_ID="20298", STEP_NAME="LOADZILE", ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
    STANDARD_ERROR="SQL*Loader-500: Unable to open file (Z:\ControlCAMarjaZilnic.ctl)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: The system cannot find the file specified."
    The file is on the network drive and it mname is correct - I am sure of this
    What's wrong?
    Thanks in advance,
    Aurel

    Hi,
    My environment consist in Windows 2003 Server and Oracle database 10.2.03 database
    My job must read 2 files from an network drive - mapped on Z , load files in Oracle database and process data for output on some devices
    I build a CHAIN based job
    BEGIN
    DBMS_SCHEDULER.create_chain (chain_name => 'loadchain',rule_set_name => NULL,evaluation_interval => NULL,comments => 'Loading chain.');
    END;
    I defined programs : trunc and processing as STORED_PROCEDUREs and sqlldrDays and sqlldrMonths as EXECUTABLEs
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM(program_name=>'trunc',program_type=>'STORED_PROCEDURE',program_action=>'XXBLU.xxblu_dex_vanzari_pkg.Truncatelunizile',number_of_arguments=>0,comments=>'Truncate for loading',enabled=>FALSE);
    DBMS_SCHEDULER.ENABLE(name=>'trunc');
    END;
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM(program_name=>'sqlldrDays',program_action=>'c:\oracle\product\10.2.0\client_1\BIN\sqlldr.exe',program_type=>'EXECUTABLE',number_of_arguments=>2,comments=>'Loading days',enabled=>FALSE);
    DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(program_name=>'sqlldrDays',argument_position=>1,argument_type=>'CHAR',default_value=>'xxblu/xxblu@dextera',out_argument=>FALSE);
    DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(program_name=>'sqlldrDays',argument_position=>2,argument_type=>'CHAR',default_value=>'Z:\ControlCAMarjaZilnic.ctl',out_argument=>FALSE);
    DBMS_SCHEDULER.ENABLE(name=>'sqlldrDays');
    END;
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM(program_name=>'sqlldrMonths',program_action=>'c:\oracle\product\10.2.0\client_1\BIN\sqlldr.exe',program_type=>'EXECUTABLE',number_of_arguments=>2,comments=>'Loading months',enabled=>FALSE);
    DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(program_name=>'sqlldrMonths',argument_position=>1,argument_type=>'CHAR',default_value=>'xxblu/xxblu@dextera',out_argument=>FALSE);
    DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(program_name=>'sqlldrMonths',argument_position=>2,argument_type=>'CHAR',default_value=>'Z:\ControlCAMarjaLunar.ctl',out_argument=>FALSE);
    DBMS_SCHEDULER.ENABLE(name=>'sqlldrMonths');
    END;
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM(program_name=>'processing',program_action=>' XXBLU.xxblu_dex_vanzari_pkg.Prelucreaza',program_type=>'STORED_PROCEDURE',number_of_arguments=>0, comments=>'Processing for BlackBerry output',enabled=>FALSE);
    DBMS_SCHEDULER.ENABLE(name=>'processing');
    END;
    This chain has 4 steps : truncatetabsStep,loadDaysStep,loadMonthsStep and processingForDexteraStep
    BEGIN
    DBMS_SCHEDULER.define_chain_step (chain_name => 'loadchain',step_name => 'truncatetabsStep',program_name => 'trunc');
    DBMS_SCHEDULER.define_chain_step (chain_name => 'loadchain',step_name => 'loadDaysStep',program_name => 'sqlldrDays');
    DBMS_SCHEDULER.define_chain_step (chain_name => 'loadchain',step_name => 'loadMonthsStep',program_name => 'sqlldrMonths');
    DBMS_SCHEDULER.define_chain_step (chain_name => 'loadchain',step_name => 'processingForDexteraStep',program_name => 'processing');
    END;
    I want to run these tasks sequential
    BEGIN
    DBMS_SCHEDULER.define_chain_rule (chain_name => 'loadchain',condition => 'TRUE',action => 'START truncatetabsStep',rule_name => 'chain_rule_1',comments => 'Truncate step');
    DBMS_SCHEDULER.define_chain_rule (chain_name => 'loadchain',condition => 'truncatetabsStep completed',action => 'START loadDaysStep',rule_name => 'chain_rule_2',comments => 'Load days');
    DBMS_SCHEDULER.define_chain_rule (chain_name => 'loadchain',condition => 'loadDaysStep completed',action => 'START loadMonthsStep',rule_name => 'chain_rule_3',comments => 'Load Months');
    DBMS_SCHEDULER.define_chain_rule (chain_name => 'loadchain',condition => 'loadMonthsStep completed',action => 'START processingForDexteraStep',rule_name => 'chain_rule_4',comments => 'Processing for Dexterra');
    DBMS_SCHEDULER.define_chain_rule (chain_name => 'loadchain',condition => 'processingForDexteraStep completed',action => 'END',rule_name => 'chain_rule_5',comments => 'End of chain');
    END;
    I enabled the chain
    BEGIN
    DBMS_SCHEDULER.enable ('loadchain');
    END;
    I run the chain
    BEGIN
    DBMS_SCHEDULER.run_chain (chain_name => 'loadchain',start_steps => 'truncatetabsStep',job_name => 'loadchain_run_job');
    END;
    When I watch user_scheduler_job_run_details I can see STORED_PROCEDUREs programs succeded and EXECUTABLEs (sqlldr based) didn't
    in additional_info table I can read - STANDARD_ERROR="SQL*Loader-500: Unable to open file (Z:\ControlCAMarjaZilnic.ctl) and
    STANDARD_ERROR="SQL*Loader-500: Unable to open file (Z:\ControlCAMarjaLunar.ctl) respectively
    But this file exists - I copied path+filename from error messge and I pasted in comand prompt
    Many thanks,
    Aurel

  • How do I copy RaW files from Mac to external hard drive? I only seem to be able to copy jogs

    I would like to copy photos from Mac to external drive but when I do they are saved as jpgs. I really want the origianl RAW files. What am I doing wrong?
    thanks

    If you don't tell is what you're doing how can we know what you're doing wrong?
    This works:
    File -> Export and set the Kind to Original
    Regards
    TD

  • Can I copy files from an external NTFS formatted drive to my Mac?

    My PC laptop died and I have two external NTFS formatted hard drives. I also have a desktop Mac.
    I searched and came across another post dated Sept 2005 in the Support Forum that asked this similar quesiton I post. Sorry if i appear to sound repetitive but I really need  confirmation to the answer for reason stated below.
    The answer given then was as follows, "Max OSX can only read files on an NTFS formatted external hard drive -- it cannot write files to such a drive [OK, that is clear to me]. If you copy a file from an NTFS formatted hard drive to the internal hard drive of your Mac, there are absolutely no restrictions on what you can do to that copy of the file."
    So, to me this means I can modify the JPEG file in my Mac using Photoshop, right? No reformatting of the NTFS drive is necessary? If so, please let me know ASAP as i have a deadline to return the brand new PC which I purchassed thinking that that was my solution.
    I pose this question to this forum because the original post is 8 years old and wonder if OS compatibility issues remain the same.

    If you want to modify the JPEGs you have on the NTFS external disk, you will have to copy the images to your Mac hard disk before editing them.
    If you want to edit files on a NTFS external disk, you have to install a third-party application as Paragon NTFS

  • Copying files from Mac to PC network shared drives.

    Copying files from Mac to PC network shared drives.
    We have shared mounted drives in AIX Fusion that we can pull files from and copy to the mac, however we can not copy files from the mac to the drives.
    “Error in user parameter list (-50)” With MS DOS-Formatted Volume.”
    The drives are mapped on the mac using SMB. We can go to the files on the mac and use “save as” and this works and saves them on the shared drives.
    We can not drag and copy them to the shared drives. Every time it fails and we get the above error. We can create folders but not move any files.
    When we look up the error, it is referring to certain characters that can but used in a Max OS X filename and are not allowed in MS-DOS filenames. We are not using any of the characters not allowed.
    The drives have all the basic set up in AIX, RWC. All the PC's we have can drag files to and from all our shared drives.

    Either install software which enables the Mac to write to NTFS drives, or MacDrive on the PC, or reformat any drives you'll be using to share files between the computers as either FAT32 or exFAT.
    (88270)

  • Can't copy some files from Windows 7 to Mac OSX over network

    Hi,
    I'm running the latest version of Max OSX v10.8.4 on a brand new Macbook Pro.
    I have followed the setup instructions at http://www.7tutorials.com/how-change-workgroup-mac-os-x-easy-networking to access my Macbook from Windows, and http://www.howtogeek.com/howto/24950/how-to-share-a-folder-in-os-x-with-windows/ to share some folders from my Macbook to Windows.
    I am now trying to copy some files from my Windows 7 Pro (SP1) computer to my Mac, and have hit the following problems:
    I can view my Macbook in my list of local networked computers on WIndows, but I cannot access it. Clicking on it causes Windows 7 to try and access it, but then I get a message after a minute saying the network path could not be found. However, if I manually enter the IP address of my Macbook in the Windows address bar (\\192.168.0.191), I can view and access all the shared folders. I can never access the Macbook via it's computer name (\\MACBOOK-ROB).
    I cannot copy some files from Windows to my Macbook shared folders via Windows. There is nothing to distinguish these files from the hundereds of other files that I have successfully copied to my Macbook. They are pictures and music with no special characters in the filenames, not overly long filenames or folder paths, no access restrictions, or any other security restriction that I can see. However, every single attempt to copy these files to my Macbook results in WIndows reporting that access to the destination was denied.
    I have tried both these above scenarios on WiFi and Ethernet, and the results are the same.
    So:
    Why am I unable to access my Macbook by it's computer name on the network? How can Windows see it, but not access it?
    What are the limitations on transferring files over SMB that is (presumably) causing these specific files to fail?
    Thanks for any help you can offer.

    I have a fix for inability to copy files. I had the same problem moving a lot of old files across my LAN from a Windows XP machine to a Mac Mini running Mountain Lion. After confirming copy of some special file, I would get an error that terminated the copy operation, and info on the Mac side would show a locked folder.
    I finally decided to eliminate all special files on the Windows side, before copying, by running
         attrib -s -h -r /s /d [drive or folder]\*.*
    in a command window. Running attrib /?  tells what the arguments mean, but it doesn't explain that you need the *.* to make the command go through the hierarchy clearing the special attributes on all the files.
    After I did that, and then used drag and drop between two Windows Explorer windows (one on the Windows drive, on on the target drive on the Mac), the whole move operation ran to completion without stopping either for error or to ask for confirmation.
    I do not have a fix for the inability to access some computers by name rather than by IP address. I'm looking into the possibility of activating bind on the Mac but I haven't done anything yet.

  • Copy file from local host to remote host

    Hello,
    I need to copy a simple file from local file system , to another computer on the same network.
    How should i do that in a simple java program ?
    Thanks !

    Well , I tried that from winXP to winXP on another machine and it worked great :
           InputStream in = new FileInputStream(new File("C:\\temp\\myFile.txt"));
            OutputStream out = new FileOutputStream(new File("\\\\9.143.85.143\\c$\\tmp\\myFile.txt"));
            // Transfer bytes from in to out
            byte[] buf = new byte[1024];
            int len;
            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            in.close();
            out.close();
      BUT, in order to copy to a linux machine, I tried to put this as the new File :
    OutputStream out = new FileOutputStream(new File("\\\\9.143.86.145\\root\\tmp\\myFile.txt"));
      and it doesn't work. How should I format the new File path in order to copy to a linux FS ?
    Thanks !

  • Need to copy .txt file from FTP server and downloaded on local server directory.

    I need to figure out a way to copy .txt file from ftp server in local server directory using sql jobs.

    Below links will help achieving it:
    https://www.virtualobjectives.com.au/sqlserver/ftp_scripts.htm
    http://www.mssqltips.com/sqlservertip/2884/sql-server-integration-services-ssis-ftp-task-for-data-exchange/

  • Copy a file from URL to local HDD

    Hi,
    I've got 2 problems:
    1. I'm an absolute beginner and an german-speaking user of this forum
    2. I want to copy a file from within a signed applet (with full access permissions) from a URL on the server to a local directory on the client. It works with .txt or .ini files, but not with .dll or .exe. The .exe file has only 1KB instead of the 5MB and contains only something like "-1". Help!!
    Here's what i made:
    URL updateurl = new URL(getCodeBase() + "testfile.exe");
    InputStream in = updateurl.openStream();
    FileOutputStream out = new FileOutputStream("C:\\temp\\testfile.exe");
    byte[] buf = new byte[4096];
    int len;
    while ((len = in.read(buf)) > 0)
         out.write(buf, 0, len);
    out.close();
    in.close();
    Thanks for any help!
    cmon42

    From looking at the code I can't see any blatant errors.
    The only thing I can think of, is: is your code wrapped by a try/catch block which you are ignoring?
    The reason I ask, is that maybe you are not downloading the file you intended in the first place. The reason I think this is because of the line:
    URL updateurl = new URL(getCodeBase() + "testfile.exe");Shoudn't there be a separator between getCodeBase() and testfile.exe? Only a guess, since getCodeBase may already return the separator.
    HTH,
    Manuel Amago.

  • Copy file from local system to Azure VM using powershell

    Hi
    Is there a simple powershell command to copy a small file from local computer to Azure VM. Point to Site is not an option for me.
    I am hoping for something simple like
    Copy-Item C:\Wabash\Logfiles\trasfer.txt -Destination C:\Presentation -ConnectionUri $uri -Credential $credential
    similar to Invoke-Command
    The only other option i have seen is 
    http://www.mattwrock.com/blog/copy-files-from-local-computer-to-an-azure-vm
    which i fell for my purpose is over kill.

    Hi,
    I will mark Ed's post as answer, if you fount that doesn't give you help, please feel free unmark it and follow up with more information.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I had a system crash(with Vista).I cannot start up windows on that drive.I have Win 7 on a new drive.I can access the files on the old drive to copy them.I would like to know how to find and copy the bookmarks from Firefox on the old drive and copy to the

    Hi:
    I had a system crash and I cannot start windows (Vista)on it.I have a new drive running Win 7.How do I copy the files from the old drive's files to the new?The Bookmark files that is.
    Thanks.Any help is appreciated.
    Shaun

    This could help.
    http://support.mozilla.com/en-US/kb/Backing+up+your+information
    Basically, you have to copy your profile from the old hdd to the new one.

  • Trying to copy ANY file from my MacBook Pro to an external hard drive spins for 45 minutes then fails. I hate this computer and WISH I never would have wasted my money. Any ideas? WD My Passport 2TB Drive, had to buy a program to make the POS write

    Trying to copy ANY file from my MacBook Pro to an external hard drive spins for 45 minutes then fails. I hate this computer and WISH I never would have wasted my money. Any ideas? WD My Passport 2TB Drive, had to buy a program to make the POS read files. Copies that would take seconds from a Windows based machine never complete. I have to close the transfer or shut off the machine half the time. Worst computer I have EVER owned, crashes non-stop, constantly freezes, and seems like EVERY operation is more complicated with this thing. Literally, my 1997 Compaq was FAR MORE reliable and user friendly.

    This is one of the messages I keep getting; The Finder can’t complete the operation because some data in -- File Whatever -- can’t be read or written.(Error code -36)
    I have copied things to the hard drive in the past, but it has always been incredibly slow, and now just seems to freeze and fail

  • How to copy a file from application server to local system

    Guys,
    Need to copy a file from application server to local system.Is there an FM for the same.
    Tried searching for it but couldn't find anything useful.
    Code snippets will be highly appreciated.
    Warm Regards,
    P.
    Moderator message: very frequently asked and answered question, obviously you did not search thoroughly, all points removed.
    Edited by: Thomas Zloch on Dec 3, 2010 4:48 PM

    hi,
    You can use the transactions CG3Y or through program u can do like this..
    DATA: BEGIN OF IT_FILE OCCURS 0,
                    LINE TYPE STRING,
               END OF IT_FILE.
    OPEN DATASET <file_name>  FOR INPUT IN TEXT MODE ENCODING DEFAULT.
            IF SY-SUBRC IS INITIAL.
              DO.
                READ DATASET<file_name> INTO IT_FILE-LINE.
                IF SY-SUBRC = 0.
                  APPEND IT_FILE.
                  CLEAR IT_FILE.
                ELSE.
                  EXIT.
                ENDIF.
              ENDDO.
            ENDIF.
    CLOSE DATASET <file_name>.
    Download it to local system using  FM - GUI_DOWNLOAD

  • How do i copy my files from my external hard drive onto my imac

    how do i copy my files from my external hard drive onto my imac

    You should be able to 'migrate them' without having to do so during a reinstall, from an external drive. In some cases, you may be able to use TimeMachine software even if the drive had not been used as a backup.
    The usual way, though, is to drag & drop copy from one to another (volume or folder) you created in there and have open. Or drag an item on top of the icon of a hard disk drive when it is mounted on the desktop. I'm used to working with open folders and windows, because that works best; and then see if I want to change how things look inside their destination. This helps should I later want to burn them to a DVD and have it correct. And I want to know where they are.
    I had more links to some information about importing or migrating data into a Mac from an external, a week ago, but can't find them now. A few good links to pages, but I think I posted what I did find directly to answer someones question about it; and believe the info was in an Apple Support article about TimeMachine, near the lower part of the page with blue words with a disclosure triangle, so you could read more in that page. But I don't believe these two are correct in that TimeMachine (some versions) only allow wireless backup to a drive in a base station unit such as Apple sells, for this. The link I saw simply said how to work around not using the wireless stuff. Maybe it was a dated item, not in these?
    See a main general portal to TimeMachine support,
    here: http://www.apple.com/support/timemachine/
    Or basics that may not provide optional copy methods:
    Mac Basics - Time Machine backs up your mac:
    http://support.apple.com/kb/ht1427
    Perhaps a search of Apple Support database (or even ASC discussions?) would yield ideas, and perhaps find what may work for the kind of files you want to copy, and where they can be found & used later. Are the files for specific applications? Or images, music, etc?
    Good luck & happy computing!
    edited.

  • SQL 2012 Cluster- How to or Steps to Move Tempdb Files from Local drive to Shared volume

    Hi..
     I did Installation of SQL Server 2012 Cluster. During this setup I installed Tempdb Files on Local drive. Now I want to move this tempdb files from local drive to Shared Drive . When I am trying to move I am getting below error.
    Does any one can help me or provide the steps to move this tempdb files from local drive to Shared Drive ?
    Msg 5184, Level 16, State 1, Line 1
    Cannot use file 'Z:\Tempdb\tempdb.mdf' for clustered server. Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource
    of the Sql Server does not have a dependency on it.
    Thanks 
    Regards..
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

    Hi,
    The error message may be thrown out when you attempt to create a database on another shared cluster drive when the SQL Server resource is not dependent on that disk.
    Check if you are in the scenario which mentioned in the following article:
    How to create databases or change disk file locations on a shared cluster drive on which SQL Server was not originally installed
    http://support.microsoft.com/kb/295732/en-nz
    Here is a thread with similar issue:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c9f80af7-5b51-4c43-a2a0-f9c7d97aa41d/sql-disk-dependency-problem-on-sql-2008-cluster-including-errors
    Hope it helps.
    Tracy Cai
    TechNet Community Support

Maybe you are looking for