How to move files from one folder to another folder in webdynpro java for sap portal

Dear Experts,
I wan to move files from one folder to another folder in SAP portal 7.3 programmatically in webdynpro java.
My requirement is in my portal 1000 transport packages is their. Now i want to move 1 to 200 TP's into Archive folder.
Can you please help me how to do in through portal or wd java ...
Regards
Chakri

Hello,
Do you know what the difference between copying a file this way :
** Fast & simple file copy. */
public static void copy(File source, File dest) throws IOException {
FileChannel in = null, out = null;
try {         
in = new FileInputStream(source).getChannel();
out = new FileOutputStream(dest).getChannel();
long size = in.size();
MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);
out.write(buf);
} finally {
if (in != null) in.close();
if (out != null) out.close();
================SECOND WAY============
AND THIS WAY:
// Move file (src) to File/directory dest.
public static synchronized void move(File src, File dest) throws FileNotFoundException, IOException {
copy(src, dest);
src.delete();
// Copy file (src) to File/directory dest.
public static synchronized void copy(File src, File dest) throws IOException {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dest);
// 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();
And which is better? I read up on what each kind of does but still a bit unclear as to when it is good to use which.
Thanks in advance,
JavaGirl

Similar Messages

  • How to move files from  one  system  to another in plsql

    Hi all,
    I want to move file from one system to another using plsql procedure .
    Kindly let me know what package i have to use for doing this .
    Thanks,
    P Prakash
    Edited by: prakash on Jul 27, 2011 2:20 AM
    Edited by: prakash on Jul 27, 2011 2:59 AM

    BluShadow wrote:
    That's ok if you want to diet. ;)Ooh look, the strange punctuation is back. Can it be true that the forum software has caught up with the '80s?
    I almost feel like connecting to the internet using a 9600 baud modem to celebrate.
    http://upload.wikimedia.org/wikipedia/commons/5/5d/TeleGuide-terminal.jpg
    Colon dash right bracket.
    (Old habits die hard)

  • How to move files from one user to another?

    I have an account for my wife on my iMac and started up in her account and then backed up her iBook into this account (on my computer). I wasn't thinking that this would mean her files would not be accessible to me. Is there a way to be able to transfer some of these files to my Documents folder?
    Thanks for any suggestion.
    Richard

    Richard,
    Don't worry. It is kind of complicated and kind of redundant. There are little buttons at the top right of each poster's post that say helpful and solved and reply and email. You can award the post as either helpful or solved in addition to marking your whole question as solved. It takes a little getting used to but you'll see how it works.
    Good luck in '07!
    Steve M.

  • How do I move files from one album to another?

    How can I move files from one album to another? And why does itunes split up imported folders?

    Press the Command key while dragging them.
    (58054)

  • Can't move files from one volume to another

    Using the 1.2 client on SLED, I don't appear to be able to move files from
    one volume to another. I have two drive "mappings", each to a
    different volume on a NW65SP5 box, but when I try and cut and paste files
    I get an error saying "Not on the same file system". However if I drop to
    a terminal and just use mv, that works.
    Is this a known issue?
    Joe

    On Tue, 12 Sep 2006 12:59:23 +0000, Joseph Marton wrote:
    Hmm, yep get the smae problem when trying to move files.
    Copy works just great though.
    I know there are some issues in Gnome/Nautilus that's being worked upon.
    These are outlined in the Readme. For example it's not possible to copy a
    folder from Server A to Server B, then delete the folder form Server A.
    Finally later on copy the folder back to Server A from Server B.
    Also Gnome is leaking file handles, which could be the cause for the
    problem we're getting here.
    I'll ask my contact at Novell about this and have him enter it in as a bug
    if it's not a known issue.
    For a workaround you already have a good alternative of using mv in a
    terminal.
    Niclas Ekstedt, CNA/CNE/CNS/CLS
    Senior Network Consultant/NSC Sysop
    Telindus Sweden AB

  • Ssis - move files from one directory to another and rename destination file if present

    Hello,
    How is it possible to move files from one directory to another directory and if the file already exists in destination directory then rename it?
    Thanks

    1. Use a foreach loop with file enumerator pointing to first directory.
    Inside loop have a ssis variable of type string to get filename (@[User::FileName])
    Choose option as Fully Qualified in loop
    2. Add another variable called @[User::DestFileName], set EvaluateAsExpression true for it and set expression like this
    REPLACE(@[User::FileName],<source directory path>,<destination directory path>)
    put actual paths in above expression in your case
    and another variable called @[User::RenameFileName], set EvaluateAsExpression true for it and set expression like this
    REPLACE(@[User::FileName],".","_old.")
    3. Create a boolean variable say @[User::FileEXists]
    4. Add a Script Task inside the loop and pass @DestFileName variable in ReadOnly mode and FileExists in ReadWrite mode
    Inside Script Task write code as per below
    http://blog.dbandbi.com/2013/11/13/check-file-exists-ssis/
    5. Add File System Task choose operation as Rename File, Select IsSourcePathVariable as true and select @[user::DestFileName] variable and IsDestinationPath variable as true and select @[user::RenameFileName] variable
    6. Choose ExpressionAndConstraint option for precedeence constraint from ScriptTask to above File System Task and choose constraint as OnSuccess and expression as
    @FileExists == True
    7. Add another File System task with operation as Move File Select IsSourcePathVariable as true and select @[user::FileName] variable and IsDestinationPath variable as true and select @[user::DestFileName] variable. Join Script Task as well as
    File System Task above to this task and choose constraint as OnSuccess and Multiple Constraint option as Or (dotted line)
    Then once executed it will work as per your requirement
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Can I move files from one caralog to another?

    Can I move files from one caralog to another?

    No. you cannot.
    This, among many other reasons, is why multiple catalogs are not recommended.
    (You could import the photo into another catalog, and delete from the first catalog ... and without first using the command File->Write Tags, you will lose your tags, captions and other metdata; version sets, stacks, album/collection membership are lost in any case)

  • How to move materials from one sloc to another sloc  materials are more tha

    Hi,
    Can any one help me on this issue How to move materials from one sloc to another sloc  materials are more than 1000
    and from existing sloc to new sloc which is Hum managened i need help onthis issue thanks

    hi
    use T-code: MB1B Transfer Posting
    Movement type:
    311 Transfer posting storage location to storage location in one step
    The quantity is transferred from unrestricted-use stock of the issuing storage location to unrestricted use in the receiving storage location.
    Possible special stock indicators: E, K, M, Q
    313 Stock transfer storage location to storage location in two steps - removal from storage
    The quantity is transferred from unrestricted-use stock of the issuing storage location to stock in transfer in the receiving storage location.
    Possible special stock indicators: None

  • How to move value from one tlist to another tlist in same form?

    how to move value from one tlist to another tlist in same form on button press?
    Same like in data block wizard when we select value from 1st list it will go to 2nd list and can be move back. Please help i am new to forms .
    Regards

    just call the following proc in your add & add all buttons. Reverse the code for REMOVEs
    this proc will move one item at a time from list_item1 to list_item2.
    PROCEDURE add_an_item
    IS
      v_list_count    NUMBER;
      v_item1_label  VARCHAR2(60);
    BEGIN
      IF :list_item1 IS NOT NULL THEN v_list_count := nvl(Get_List_Element_Count('list_item1'),0);
          IF v_list_count >= 1 THEN FOR i IN 1..v_list_count
          LOOP
             IF   :list_item1    = Get_List_Element_Value('list_item1', i)
             THEN
                  v_item1_label := Get_List_Element_label('list_item1', i);                 
                  Add_List_Element('list_item2',1,v_item_label,:list_item1);         
               Delete_List_Element('list_item1',i);
               Exit;
             END IF;
          END LOOP;
           END IF;
       END IF;
    END;
    *********************************************************************************this proc will move all items from list_item1 to list_item2.
    PROCEDURE add_all_items
    IS
      v_list_count NUMBER;
      v_item_label VARCHAR2(60);
      v_item_value VARCHAR2(60);
    BEGIN
    v_list_count := nvl(Get_List_Element_Count('list_item1'),0);
    IF    v_list_count = 1 AND Get_List_Element_Value('list_item1', 1) IS NULL THEN NULL;
    ELSIF v_list_count >= 1 THEN
           FOR i IN 1..v_list_count
           LOOP
            v_item_value  := Get_List_Element_Value('list_item1', i);
            v_item_label  := Get_List_Element_label('list_item1', i);       
            Add_List_Element('list_item2',i,v_item_label,v_item_value);
           END LOOP;
           clear_list('list_item1');
    END IF;
    END;I added [ code ] tags to make this easier to read.
    Message was edited by:
    Jan Carlin

  • How to move iTunes from one user to another on the same Windows 7  computer

    How to move iTunes from one user to another on the same Windows 7 computer? Thanks, Bob

    Move the iTunes library to a shared area and then into the desired location. If this isn’t the default one, launch iTunes with the Shift key held down and choose that library.
    (122379)

  • How to copy file from  one location to another

    Hi,
    I am new to java, I tried the following code to move the file from one location to another
    public class CopyFiles {
    public String copy ( File source, File target)
    throws IOException {   
    FileChannel sourceChannel = null;
    FileChannel targetChannel =null;
    try {   
    sourceChannel =new FileInputStream(source).getChannel();
    targetChannel= new FileOutputStream(target).getChannel();
    targetChannel.transferFrom(sourceChannel, 0,
    sourceChannel.size());
    finally {   
    targetChannel.close();
    sourceChannel.close();
    return "Success";
    public static void main(String [] args) throws Exception{   
    File source = new File("C:\\users\\download.pdf");
    File destinationFile = new File("C:\\apple\\download.pdf");
    copy(source, destinationFile);
    The above code is working perfectly, but I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.

    kameshb wrote:
    I Don't want to include the file name in destination file. i.e. File destinationFile=new File("C:\\apple"), and at the same time the pdf with same name has to get stored in the destination location, how can I achieve this.It's not totally clear what you're saying here, but what I think you mean is that you don't want to explicitly set the destination file name--you want to just give the copy the same name as the original. Yes?
    If that's the case, then break the original up into separate directory and file name portions, and then construct the destination path from the destination directory plus original file name. You can do that by manipulating the full path string, or by using the methods in java.io.File.

  • How to transfer file from one client to another client?

    hello,
    i have some questions and hope you all can help me..thanks a lot first..
    Here are the questions:
    i) How can i send a file from one client to another client using RMI?
    ii) Does the client(sender) need to send the file to server, then server save it and then send it to another client(receiver)?
    iii) If using RMI, a client can receive two files from same client(sender) or different client(sender) at a same time? how to do it? when both of the files come in from same port, how to differenciate them?
    iv) For your information, i am doing the File Transfer Server-client application which sender can send any file to other client. Can you give me any ideas? thanks..
    Last, thanks again..

    Your questions reflect some ambiguity in terms.
    "Client" and "server" are commonly used in two different senses:
    1. Technical sense: A client process makes requests, and a server process fulfills the request (provides a service).
    2. IT sense: A client computer (process) makes requests of a server (computer) process, and the server (computer) processes the request.
    In the first case, any computer might be a client, or a server, or both, depending on the processes being executed. In the second case, the computers are assigned some role.
    So: If you wanted to, you could implement client/server processes communicating between two peer computers, using RMI.
    This may not be what you wanted; if you really want to distinguish client and server computers, then the answer is that yes, you will probably put files into intermediate storage on the server computer.
    Finally, you probably do not have to worry about port conflicts if you use RMI; while the initial client server contact is established through a registry operating on a standard port, the actual RMI communications is established using random ports, one for each link.

  • Move file from one library to another library via SharePoint 2010 Designer Workflow

    Can SharePoint 2010 designer be able to move a file from one library to another using workflow?  I tried to use the copy list item but it won't show my destination library.  I prefer not to use the 3rd part workflow like
    http://www.codeplex.com/SPDActivities
    Please advise.
    Brian
    Brian

    Hi Brain,
    From your narration, I undersatnd that you want to move document to another library across site or site collection. However,
    the copy list item action is used for coping list item to another library or list in the same site, so you can’t achieve it through ootb workflow action. So to move document to another library across site under the same site collection, then you can use site
    content and structure. If across site collection, then I suggest you use that the 3<sup>rd</sup> part workflow action.
    For more information about site content and structure,
    http://office.microsoft.com/en-us/sharepoint-server-help/work-with-site-content-and-structure-HA010131723.aspx
    Best Regards.
    Kelly Chen
    TechNet Community Support

  • How to move cursor from one textfield to another textfield byusing enterkey

    hii all,
    I have a problem in java script.
    To move cursor from one textbox to another text box ,I have take the length of the textboxes of the first column.I used onkeyDown event .
    in the function ,firest i checked the condition like
    for(i=0;i<form1.box.length;i++) //box is the name of the textboxes
    if(event.keyCode==13)
    form1.box[i+1].focus();
    return false;
    by using this the cursor is moving from first text box to secon textbox and stops.
    if i use event.returnValue=false; instead of return false ,then the cursor automatically going to the laxt textbox of the column.
    my problem is how i can focus the cursor from one textbox to another textbox one after the other till the end.
    if any one has solution please help me.
    also if we can do in another way also,please help me.
    thanx.>

    try the following code :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <SCRIPT language="Javascript">
    function fnTest(str)     {     
              if(event.keyCode==13)          {
                   if(str == 4)     {
                        formHeader.box[0].focus();
                   else     {
                        formHeader.box[parseInt(str)+1].focus();
                   return false;
    </SCRIPT>
    <BODY>
    <FORM name="formHeader">
    <CENTER>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('0');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('1');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('2');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('3');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('4');">
    </CENTER>
    </FORM>
    </BODY>
    </HTML>
    ----------------------------------------------

  • How to move tabs from one screen to another?

    Just started to group tabs. How can I move tabs from one screen to another to consolidate them into the groups?

    See <b>Tab Groups</b> (new in Fx4) (Panorama) [http://support.mozilla.com/en-US/kb/what-are-tab-groups What are Tab Groups] (video included)
    From one Window to another Window, by drag & drop
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>

Maybe you are looking for

  • Acrobat 5.0 - Excel conversion

    I'm having trouble printing Excel forms in Acrobat 5.0   I can only get 2/3 of the document and Acrobat stops.  I've reset the print range in Exce and that doesn't help.  Any suggestions?

  • Flash Player 11.7.700.169 and 11.7.700.178 Not loading External Audio

    We have a website that uses Action Script 2 (AS2). We load .mp3 files from our server to our flash program on our website. Sounds built into the flash library load fine, but .mp3's loaded from our server do not. The audio loads a few seconds of the f

  • Import/export synchronization mappings

    Hi everyone, is it possible to import/export mapping in data synchronizations? I'm going to implement a huge amount of mapping rules and I thing there might be a way how to do it more quickly than clicking every rule manually... Thanks for every answ

  • Error message 9041:why will cd not burn?

    I am getting an error message of 9041 when trying to burn a cd.  What does this mean?  What can I do.  I have a radio show tomorrow and have to burn this cd!

  • Reinstallation photoshp elements 6 after a computer demage.

    I lost my installed program because of a Computer demage. Now the Computer is ok again and i would like to install the program photoshop elements 6 again. The Problem is that during the install procedure I get only a Information: The key-sentence is