Copying & comparing File Content

I have Written a java code, which is taking the content of one file and copying it in to another file, by replacing its content. I want that to get appended in the file I am copying it in. I want to compare each line of first file to the second .txt file. And if it seems to be the same, then discard that line but copies all other line.
Is it possible???

yes

Similar Messages

  • Can we compare file contents of two files in the Application server?

    Hi,
    A file is generated daily to the application server. and i need to compare the generated file to the file generated on the previous day and prepare a report.
    Can we compare file contents of two generated files present in the Application server?
    If there is any alternative, please suggest.
    regards
    cs

    yes we can compare if the app server is Unix.
    cmp compare two binary files and report if different
    cmp is silent if the files are the
         same;
    if they differ, the byte and line number at which the first
    difference occurred is reported.
    REPORT ZUNIX line-size 400
                    no standard page heading.
    data: unixcom like   rlgrap-filename.  
    unixcom = 'cmp file1 file2'.
    data: begin of tabl occurs 500,
            line(400),
          end of tabl.
    data: lines type i.
    start-of-selection.
      refresh tabl.
      call 'SYSTEM' id 'COMMAND' field unixcom
                    id 'TAB'     field tabl[].
    "if the files are different then you will some content in tabl
    Regards
    Viajy  Babu Dudla

  • Script to Compare File Contents in Two Folders and List Differences?

    I've looked through the Forum but can't find anything that seems quite to address my problem--and I'm really new to AppleScript, so please forgive me if this is a dumb question.
    I burn a great many files of varying kinds (InDesign, Illustrator, Photoshop, PDF, etc.) to DVD everyday as part of my job. It happens not infrequently, though, that files drop out in the process and don't make it to the disk, with the result that I get calls from Manufacturing saying that I've screwed up and that random files X, Y, and Z are not on the disk that I sent.
    I've tried various ways to failproof my burning routine, but utlimately, it seems like something still slips through sometimes--that is, the files are definitely in by Source Folder, but sometimes they don't leap the chasm to the disk. And since there can be several hundred files, it can be difficult to know at a glance if something is wrong.
    It would be extremely helpful if there were a script that I could run to compare the contents of the folder source on my desktop (just say its called "Source Folder") with the contents of a disk I have just burned (whose name might vary, but whose folder structure is a duplicate of the subfolders in "Source Folder" that I have burned to disk. All I need the script to tell me is if there are files in my desktop Source Folder than are not on the burned disk).
    Is this possible? I'd appreciate any help anyone could offer--right now, I'm printing up the disk directory and a list of the files from my desktop Source Folder and comparing them line for line, and my soul is dying.
    Please help!

    This can be pretty easily hacked together using a combination of AppleScript and shell scripting.
    There's a shell command diff that can tell if two directories are the same or not. You can use AppleScript to put a nice front-end on it, like:
    set src to (choose folder with prompt "Select the source directory")
    set dst to (choose folder with prompt "Select the destination directory/disk")
    try
      do shell script "diff -rq " & quoted form of POSIX path of src & space & quoted form of POSIX path of dst
    on error theErr
      display dialog "The following differences were found:" & return & return & theErr
      return
    end try
    display dialog "Directories match. No differences found"
    It's quick and dirty, but should get you started. It runs the diff command which triggers the 'on error' code if there are any differences. The script then reports the differences and exits. If there are no differences the 'on error' code is skipped and you get the all clear message.

  • Compare file contents

    Usually I take my photos in RAW format, and a matching jpeg is produced automatically by the camera software. The file names are identical except for the extension. Occasionally however for speed of working I will take some photos on the card in jpeg only -no matching RAW.
    I have a workflow that separates the RAW and jpeg files into separate folders, but I can't seem to find a method to compare folder contents so as to easily and quickly identify the "lone jpegs" (i.e. those that have no matching RAW). The comparison could of course be done before or after separation - whichever is easiest.
    Anyone tried this or similar - it seems to be not currently possible (a glaring omission IMO) but maybe there's a work round that someone's found and would share?
    Thanks in advance for any responses!

    I don't know about automator, but it's an easy one for the shell:
    cohi@tigger:/tmp> ls raw
    1.raw 2.raw 4.raw
    cohi@tigger:/tmp> ls jpg
    1.jpg 2.jpg 3.jpg 4.jpg
    cohi@tigger:/tmp> ( find jpg -name "*.jpg" ; find raw -name "*.raw" ) | sed 's/raw/jpg/g' | sort | uniq -c | grep " 1" | cut -b 9-
    jpg/3.jpg

  • To Copy the file content to another file and to delete the orginal file.

    Hi ,
    Can you pls let me know how i need to copy the contents of one file to other,
    For e.g   P_FL Consits of following records ( Assume that file need to created on application server)
      This is standard header ( header record)
    name  school class adreess ( item records)
    xyz     abc     1        kkkkk
    jjjj        cba     2       jkjkjkj
    uiui      cab     3       oioioioi
      i need to copy the above mentioned file contents( P-FL) into another file say P_NEWFL.
    so how i need to create this new file and how to copy the content of old file to new file.
    After copying the contents of old file to new file i need to delete old file.

    Sample code to implement this
    PARAMETER: p_file TYPE file DEFAULT 'd:\interface\In\barcoinbound2sap.txt',
               p2_file TYPE file DEFAULT 'd:\interface\In\backup_barcoinbound2sap.txt'.
    START-OF-SELECTION.
      OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      OPEN DATASET p2_file IN TEXT MODE ENCODING DEFAULT FOR OUTPUT.
      DO.
        READ DATASET p_file INTO line.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        TRANSFER line TO p2_file.
       IF sy-subrc NE 0.
         EXIT.
       ENDIF.
        SPLIT line AT ',' INTO lit_barco-prodnorder lit_barco-quant lit_barco-machtime lit_barco-duedate.
        APPEND lit_barco.
        CLEAR lit_barco.
      ENDDO.
      CLOSE DATASET p_file.
      CLOSE DATASET p2_file.
    dalete dataset p_file

  • Comparing file content

    Good morning,
    I am trying to determine if records in one text file are a subset of records in a second file.
    For example the 1st file(A) contains the names
    jan
    eva
    john
    And the second(B) contains
    eva
    richard
    jan
    paul
    I've started by formulating the problem in simple English:
    "If all file A contents IN file B return TRUE
    else return FALSE"
    The code below compiles and runs. The problem is that it produces faulty results.
    When comparing A to B, for example it returns TRUE. I'm guessing this is because the loop is exited as soon as the condition evaluates to TRUE, which leaves the file only partially read.
    Comparing B to A yields FALSE as it should.
    I imagine that I'll need to modify the loop so it first reads all the records in the first file and then compares them to the records in the second file.
    So, my question, finally ;-), is:
    can anyone give me some tips on how to adjust this code?
    public boolean containsSame(String filenameb) throws IOException
         Stream a = new Stream (filename, Stream.READ);
         Stream b = new Stream (filenameb, Stream.READ);
    try
         String stra;
         String strb =b.readString();
         while((stra=a.readString()) != null)
         if(stra.equals(strb))
              System.out.println("All the names in " + filename + " are found in " + filenameb);
              return true;      //Problem seems to be here
                                       // when condition = true loop appears to end
                                       // leaving (possibly) part of the file unread
    catch (EOFException e)
              System.out.print("End of file");
              //System.out.println();
              System.out.println("All the names in " + filename + " are NOT found in " + filenameb);
              return false;
    }

    Call it inner and outer loops is not really good. The programming term is nested loops.
    Examples:
    // nested while loop
    // outer loop
    while (true) {
        // inner loop
        while (true) {
    // nested do...while loop
    // outer loop
    do {
        // inner loop
        do {
        } while (true)
    } while (true)
    // nested for loop
    // outer loop
    for (int i = 0; i < length; i++) {
        // inner loop
        for (int j = 0; j <= i; j++) {
    }Of course you could have any number of loops inside a loop. An you could have any combination of them.
    An example:
    for (int i = 0; i < length; i++) {
        while (true) {
    }

  • Is there a way to compare the contents of a library by comparing itl files or some other files?

    Is there a way to compare the contents of a library by comparing itl files or some other files?
    I need to compare the contents of my current library to one that existed 2 months ago but ALL I have is the itl file from 2 months ago.  Can this be done?

    You are correct, many people have noticed over the years that Sound Check does not work as advertised.
    A more effective approach is to treat the files with a 3rd party volume normalization program. Although I have not personally used it, many users on this Forum have reported good results from an inexpensive program called iVolume.

  • ***** .nfc Content Copier backup file format incom...

    The PC Suite 6.70.22 Content Copier’s Restore function (running on Windows XP SP2) cannot restore the Contacts to a 6680 mobile from a .nfc file on a USB flash memory stick created earlier on another computer by PC Suite 5.8 Content Copier’s “transfer data from the phone to the PC” function (running on Windows 98SE) which copied the contacts from a 7250i mobile.
    Wishing to copy my contacts from my old 7250i mobile to my new 6680 without the expense of purchasing a DKU-5 USB cable for the 7250i (the 6680 has a DKU-2 USB cable in the box), I first copied the 7250i’s contacts using the infra red link to an old laptop running Windows 98SE by executing PC Suite 5.8 Content Copier’s “transfer data from the phone to the PC” function which created a file named “C:\Windows\Profiles\my name\My Documents\Backup files\Nokia 7250i contacts 15-12-2005.nfc”.
    I then copied this file to a USB flash memory stick and subsequently plugged the flash memory stick into a USB port on a desktop machine running Windows XP SP2. I also connected the 6680 to another USB port using the DKU-2 cable. After starting PC Suite 6.70.22, I clicked on the Get Connected! Button to get connected to my 6680. I then clicked on the Backup icon to load the Content Copier Program and clicked on the Restore button. On the next screen headed “Select back up file to be retored” I browsed to the folder on the flash memory stick containing the file “Nokia 7250i contacts 15-12-2005.nfc”, clicked on the checkbox labelled “Restore contacts, calendar etc” and clicked on the OK button.
    The following warning message was displayed :-
    You are about to restore contents from another phone model than the connected phone.
    Some content might not be restored.
    and I clicked on the OK button.
    Then the following warning message was displayed :-
    This backup file has been made from a phone that uses a different language than the target
    phone.
    To make sure that your phone and Nokia PC Suite applications function properly, it is
    recommended that you restore the backup files only in phones that use the same language as
    the source phone.
    and I clicked on the Cancel button which caused the initial Content Copier screen to be displayed.
    I think it is totally unacceptable that PC Suite 6.70.22 Content Copier cannot correctly process the files created by PC Suite 5.8 Content Copier.
    Please reply if you agree with me.
    Has anybody successfully transferred contacts between mobiles using the same or similar procedure as I have described above ?
    If so, what did you do that was different ?
    Does anybody know whether Content Copier’s .nfb backup file format is compatible between PC Suite 5.8 Content Copier and PC Suite 6.70.22 Content Copier ?
    Before I report this problem to Nokia, has anybody reported this problem to Nokia previously ?

    Yes, I am aware I can connect my 7250i to pc suite 6.7 to transfer all the data from the old phone to the new one.
    But I think you missed the point.
    I was attempting to use the resources I had without any further expenditure on hardware.
    The 7250i has an infra red and USB connection but I do not posses a DKU-5 USB cable for it.
    I was quoted around £29 for a new DKU-5 cable, although I have recently discovered that they sell for much cheaper on eBay.
    The only computer I have with an infra red link is an old Sony laptop running Windows 98SE. Sony are probably the worst computer manufacturer for not providing the latest versions of Windows with the required Sony device drivers and the Sony utility programs for their old machines. Hence if I install Windows XP SP2 on the laptop from a retail CD, I lose some Sony functions/capabilities. So I am stuck with Windows 98SE, which means I have to use pc suite 5.8 as pc suite 6.7 cannot be installed on this laptop becuse it only runs under Windows XP SP2 ns Windows 2000.
    As the 6680 mobile requires pc suite 6.7, I did this on a desktop machine running Windows XP SP2, but this machine does not have an infra red port. Hence my attempt to tranfer the .nfc file from the laptop to the desktop machine on the assumption that Nokia software developers would NOT be stupid enough to not provide backward compatibility.
    I have been a computer programmer since 1966 and know that you must always provide backward compatibity even if this means providing another program to convert a file in an old format to a file in a new format.
    I intend to lobby Nokia to do something about this and was hoping for support from others who have attempted something similar.

  • Upload 2 files and compare its contents

    Hi guys,
    I want to upload 2 files in SAP and compare its contents.
    How am i going to do that?
    Please provide sample code... Thanks a lot!
    rgds,
    Mark

    Hi Mark,
    I expected to use this code, once u can try this code.
      OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        LOOP AT gi_output1 INTO gwa_output1.
          CLEAR lv_string.
          CONCATENATE gwa_output1-matnr
                      gwa_output1-maktx
                      gwa_output1-werks
                      gwa_output1-bmeng
                      gwa_output1-posnr
                      gwa_output1-idnrk
                      gwa_output1-ojtxp
                      gwa_output1-mngko
                      gwa_output1-mmein
                      gwa_output1-flag
                      INTO lv_string
                      SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
          TRANSFER lv_string TO lv_filename.
          IF sy-subrc <> 0.
            MESSAGE e006(zpdm).
          ENDIF.              "if sy-subrc <> 0.
        ENDLOOP.
         OPEN DATASET lv_filename FOR appending IN TEXT MODE ENCODING DEFAULT.
      IF gi_output2[] is not initial.
        LOOP AT gi_output2 INTO gwa_output2.
          CLEAR lv_string.
          CONCATENATE gwa_output2-matnr
                      gwa_output2-ojtxb
                      gwa_output2-werks
                      gwa_output2-bmeng
                      gwa_output2-posnr
                      gwa_output2-idnrk
                      gwa_output2-ojtxp
                      gwa_output2-mngko
                      gwa_output2-mmein
                      gwa_output2-flag
                INTO  lv_string
           SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
          TRANSFER lv_string TO lv_filename.
          IF sy-subrc <> 0.
            MESSAGE e007(zpdm). " WITH text-006.
          ENDIF.           "if sy-subrc <> 0.
        ENDLOOP.
      ENDIF.

  • Compare SQL file tables as a file content VS Documentum or Alfresco

    Hello - Documentum & Alfresco are 2 examples of Document Content Management (file repository, workflows, notifications, etc), I am interesting in the file content management where system provides file repository and some extra features like check in
    / check out and versioning. Does anyone have tried to replace a file repository with SQL file tables?

    You can use SQL Filetables for storing files as well as doing modifcations etc. for getting versioning you can enable change management or implement audit triggers in them.
    Here are some helpful links
    http://visakhm.blogspot.in/2012/07/working-with-filetables-in-sql-2012.html
    http://visakhm.blogspot.in/2012/07/triggers-on-filetables-in-sql-2012.html
    http://visakhm.blogspot.in/2013/09/implementing-transaction-over-file.html
    Check in checkout will not be available by default. You may need to implement it using some flags. My question is why cant you go for a versioncontrol software then like TFS? why reinvent the wheel?
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to print list of file contents of a HDD

    Hi Everyone!
    (Sorry for using a quote---The copy/paste  from my old Text Editor does not work here.... why not?  Only if I am doing a quote)
    I have a Mac G4 (yes) with Tiger 10.4.11 (yes still)  and I have two backup drives.... They should be evenly "filled" but there is over 26 GB difference so that one is going to be running out of space sooner than I want it to.  I have 100's of files... I need some program that works under Tiger to either:
    1. Print the contents of the HDD (the file names/sizes, etc---there is something that does this in Windows, why not Mac?).
    or
    2.  A program that compares the contents automatically between the two HDD's.  Again I have used one on PC's but its really old and company no longer makes it for PC's.  Is there one for Mac? I have no idea how to express it to look it up.  (I never have both of the HDD's all hooked up by Firewire at same time---afraid of overloading old Mac).... so only if there is a program that does this working under Tiger would I then come back here to ask a question for how to get the two drives hooked up to compare the contents and find out what is taking up extra space.
    Mostly the drives have iPhoto items in it so it could be simply a double-entered iPhoto Roll/Album---but never thinking I'd have to compare them---most of the titles begin the same exact way---too difficult to go over unless I can cross off a printed sheet to compare the two drives---or have a computer do that for me.
    Any suggestions? 
    Thanks for reading me!
    Mac_Help

    Tex-Edit Plus
    Universal Version 4.10.2
    Mac OS 10.4 thru 10.10
    File Size: 10703K
    Tex-Edit Plus
    PPC Version 4.9.8
    Mac OS 10.1 thru 10.3
    File Size: 3970K
    Tex-Edit Plus
    Classic Version 4.1.3
    Mac OS 7 thru 9
    File Size: 5294K
    Tex-Edit
    Legacy Version 2.7.2
    Mac OS 6
    File Size: 257K
    Tex-Edit Plus (beta)
    Pre-release Version 4.10.3 b2
    Mac OS 10.4 thru 10.10
    File Size: 10705K
    Hi BDAqua!
    Thanks for the links!  I'll take both of them!  (If they fit in my old HD)
    Explaining a bit more----I'm using a "PC" to write these questions (yes I have a bunch more) about the old Tiger Mac 10.4.11 G4.
    I only have working TenFourFox7450 and OmniWeb as my only two ways to get online now.  Very slow.  Very limited windows I can open at once to compare or research things, so I'm back on the PC to do all that and copy and paste quotes here for you. Seems once I pass the first question, the only thing Quote does is quote your message---I managed to cheat a bit and got what I wanted to copy from the Tex-Edit page to show up instead..
    You recommended that I choose Tex-Edit Plus PPC Version 4.9.8---but as you see above that is only for 10.1 to 10.3 versions..... is there some reason why the  Tex-Edit Plus (Beta) above is bad for me?  It says 10.4 or higher.
    Or why not use the "Universal" Tex-Edit Plus?  Seems that covers 10.4?
    I got both TextWrangler and Tex-Edit Plus "Universal" Edition to work on the Mac!
    Page numbers on the Tex-Edit!  Wow!
    Thanks!
    Also (saving address for later)    that page has Eliza on it.. which I had long time ago.... but lost somewhere among all the other programs. So thanks for showing me I can find and add it in later on when I get more space on HDD
    I'll type now my reply to your earlier message/posting!
    Mac_Help

  • Unable to connect copied vhd files to VM Hyper-v high availability cluster.

    Hi
    I have my VMs VHD files stored on my SAN  and I have a copied one of the LUNs containing a vhd file which I have then exported to the shared storage of the hyper-V cluster which is just like and other VHD. The problem comes when trying to connect this
    copied vhd to the VM which still uses the original VHD . The system refuses reporting that it cannot add the same disk twice.. 
    These are two different VHD files
    I have: renamed the new file, changed the disk ID, changed the volume id and using vbox (because it was the only way I could find do it ) changed the uuid of the vhd file.  But still no joy.
    I can connect the volume to any other VM without any issues, but I need to be able to connect it to the same VM..
    I'm not sure how  Hyper-v is comparing the two VHD files but I need to know so I can I can connect the copy VHD without having to copy all its contents to a new VHD which is impractical..
    Anyone got any ideas or a procedure??
    windows 2008 R2 cluster with 3par SAN as storage.
    Peter

    Hi perter,
    Please try to refer to the following items :
    1. create a folder  in the LUN , then copy the problematic VHD into it ,attach the copied VHD to original VM.
    2. copy the problematic VHD file to another volume ,then attach it to original VM again .
    Best Regards
    Elton Ji
    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.

  • How can i compare the contents of two folders ?

    how can i compare the contents of two folders and find out which files are in one but not in the other?? Knowing how to do this would be the best thing ever, especially when dealing with a large number of files. Often, for instance, I'm dealing with a large number of images, processing them, and saving the retouched ones to a new folder, and need to check that they are all there. If there are say three files missing in the second folder (out of say a hundred in total) being able to automate the process of elimination would be very useful. Please help!!!
    B

    I really wish I knew the answer to this. I work between two macs, a G5 and MacBook Pro when I'm on the go. Each time I move from one to the other I have to copy all my files to the computer I'm going to work on, so I end up with the same files being duplicated. It's not a problem if it's not much data but in my case the it can be to 30GB, mostly graphics files, photoshop, motion, final cut pro, etc.
    There's has got to be a way automator can make a comparison between two folders to sort out what's changed and what's remained the same. It would be nice also if this feature could be done globally on the hard disk using spotlight's technology to stop files being duplicated in places you didn't even know about and taking up valuable disk space. I'm not sure how this could be done.
    Any bright ideas Apple?

  • Comparing folder contents

    Hi all
    This is a it embarrassing to be honest, but I find myself in a bit of a filing based mess.
    The background - skip if you don't want to hear bleating about how poor my filing is
    In a fit of idiocy I have made many duplicate folders (including multiple duplicates of content such as my 15,000 image photo library) to ensure safety of the files therein. I've done this a lot of the last three years, and find myself now in a position where I haven't got a clue what is where, and what is up-to-date.
    I have 600G odd drive space.
    I have 1 50G iMovie project, a large iPhoto library and quite a bit of music.
    I have 30G free - mainly because of my completely slap-dash method of 'backing up' - which I realise I'm not actually doing - and also because I have a lot of files copied here from other desktops, laptops and iPods.
    The question
    Obviously I have a task on my hands to sort this lot out. What would make my life a lot easier would be an application that compares the contents of two folders, and shows me where they differ - this way I am hoping to be able to completely erase great swathes of files without having to comb through them making sure I don't loose an iSight screen grab of my son smashing his Buzz into the screen or some-such. Anyone know of anything that would make my life easier here?
    I used to be fairly ordered about where I put files, and how my folders are structured, honest.
    Thanks for any help / advice / smacks on the back of the hand...
    Flea

    Arctic
    Well you have a nice project to pass the Winter nights!
    Do a search on http://www.macupdate.com using 'duplicate' as the search term. This will provide you with quite a few apps which claim to search for and remove duplicate files. Read and make your choices there.
    However, do not trash any file without reviewing it yourself. There are some things a computer cannot do, and recognising emotionally valuable items is one of them.
    Have fun.
    Regards
    TD

  • After copying a file from NTFS to HFS volume, file size changed when viewing in Windows

    Hi guys,
    I have a Mac Air running Mavericks on a HFS partition and Windows 7 on a BOOTCAMP NTFS partition. I have some files that I want to read/write from/to both systems. Since OS X can't write NTFS and Windows can't write HFS either, and I don't want to use any 3rd-party tools/drivers, I have to adopt a "stupid" way: in OS X, I copy those files from NTFS to its HFS partition, make changes, then switch to Windows and sync them back to NTFS.
    The problem is, after I copied a file from NTFS to HFS in OS X, it seemed ok. But when I switched to Windows, the very copied file in HFS partition had its size changed (bigger) although I didn't make any changes to it in OS X yet. This happens to almost every file I copied, text and binary. For those text files, I tried to open it with EditPlus in Windows and EditPlus reports the correct size on the status bar.
    How could this happen?

    I am not sure if this is what your seeing but...
    The same unaltered file on two different volumes might use different amounts of disk space. This is because a 'disk' is divided in to 'blocks' and a block (also historically known as a 'sector') is a certain minimum size. So if disk-1 has a block size of 512 bytes and disk-2 has a block size of 1024 bytes then a file containing just 10 bytes will use up twice as much space on disk-2 as disk-1 even though it is the exact same file.
    Beyond that, Macs can add additional information like Spotlight tags, labels, icons, etc. which make a file bigger. If you are modifying a file then presumably that also implies adding additional content e.g. for a Word document more text and this will make it bigger. Also depending on some programs are configured or designed 'deleting' text may only mark it as deleted and not really delete. This can apply to older versions of Word which has a 'Fast Save' feature, new versions have removed this and do a proper delete.
    You would have to give more details like what you are doing to the document, what kind of document, and what the two sizes are.
    Finally, there is one other potential difference, some systems and manufacturers use 1024 as a unit for measuring file and disk sizes, some use 1000. It will be the same number of bytes in each case but 1000 bytes in one case would exactly equal 1MB, and in the other it would be 0.9765MB.

Maybe you are looking for