Add string replacement to file renaming

This feature is very handy over in Bridge CS5 and would also be useful in LR 3.x when there is a need to replace part of a filename and not touch the sequence number applied to random files.

Hi,
If my understanding is correct,
you want to display some text  in file along with the data ,
suppose you hav data in ITAB1 declare one more internal table ITAB2
ITAB2 will hav same fields as ITAB1 but first field will be the text field for ur puspose
Example :
suppose ITAB1 contains A
                                        B
                                        C
                                        D fields
              ITAB2 will be T
                                   A
                                   B
                                   C
                                   D fields.
ITAB1 has all the required data.
ITAB2-T =  'First Line of the file'
Move-corresponding fields of ITAB1 to ITAB2.
So now ur ITAB2 contains erquired text and data.
Please let me know if you hav any queries on this.
Thanks and regards,
Sree.

Similar Messages

  • How to add strings to file?..

    Hi, everybody!
    Please, help me in a simple question:
    I have to add strings to text-file.
    ADD!
    My task is:
    if(the file isn't excist ){
    create new file, open it and write, for example, 3 strings;
    else{
    open file and ADD 3 strings;
    How to make it?
    My text-file is big - nearly 65MB..
    I'll be happy, if you can give example..

    This file allows you to add to already available file, but if not available, it will be created.
    Tell me if this helps you .
    Cheers
    * @Title    :AddFile.java
    * @date     :today
    * @version  :v1.0
    * @author   :Your name
    import java.io.*;
    import java.net.*;
    public class AddFile extends Object
        public static void main (String [] args) throws IOException
            System.out.print ("Enter your message: ");
            BufferedReader input = new BufferedReader (
                              new InputStreamReader (System.in));
            String userInput = input.readLine ();
            BufferedWriter out = new BufferedWriter (
                           new FileWriter ("akoko.txt", true));
            out.write (userInput);
            out.close ();
    }

  • Batch Rename with String Replacement?

    Is there a convenient way to batch rename files after they've been imported? The template mechanism seems to work well for creating new names, but not for renaming. For example, I originally imported and renamed my images to look like this:
    Zemke_YYMMDD_NNN-O1.CR2
    I decided I would rather have DRZ (My initials) instead of "Zemke" as the prefix. I was able to get it done with some contortions:
    Metadata/XMP/Export
    Remove all files from Lightroom
    Rename all the external files to start with DRZ
    Reimport all the files
    Delete the XMP files
    I think what is needed is for Rename to include string replacement (and string deletion) functionality. Is it already there?
    Dan

    Stefano, nonadjacent selection can be done by holding down Control and manually selecting the additional image. If you want to select a lot of separate ranges, the way to do it is to add each range to the quick collection (press the B key), then go to the quick collection and select all. It's exactly for those kinds of scenarios that quick collection exists. Once you get used to doing it, it's easier working with a "sticky" selection like the quick collection rather than the contortions required to extend standard selections.
    To slightly add to Rory's comments: two-digit year plus spelled out month names and day of the week names are also available. Combine into any order you want, with any additional supporting text anywhere you want it, and you've got huge flexibility there. And no matter how complex it is, you can save it as a preset so it's readily accessible later.

  • Search and replace strings in a file while ignoring substrings

    Hi:
    I have a java program that searches and replaces strings in a file. It makes a new copy of the file, searches for a string in the copy, replaces the string and renames the new copy to the original file, thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but searching for "Topabcd" and replacing it doesnot work because there is a match for "abcd" in a different search scenario. How can I modify the code such that if "abcd" is already searched and replaced then it should not be searched for again or rather search for "abcd" as entire string and not if its a substring of another string.
    In the below code output, all instances of "abcd" and the ones of "Topabcd" are replaced by ABCDEFG and TopABCDEF respectively, whereas according to the desired output, "abcd" should be replaced by ABCDEFG and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
              String find_productstring = "abcd";
              String replacement_productstring = "ABCDEFG";
              compsXml = new FileReader(compsLoc);
              compsConfigFile = new BufferedReader(compsXml);
              File compsFile =new File("file.xml");
              File compsNewFile =new File("file1.xml");
              BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
              while ((compsLine = compsConfigFile.readLine()) != null)
                    new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
                    out.write(new_compsLine);
                    out.write("\n");
                out.close();
                compsConfigFile.close();
                compsFile.delete();
                compsNewFile.renameTo(compsFile);
            catch (IOException e)
            //since "Topabcd" contains "abcd", which is the search above and hence the string "Topabcd" is not replaced correctly
             try
                   String find_producttopstring = "Topabcd";
                   String replacement_producttopstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
                   compsConfigFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
                   BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
                   while ((compsLine = compsConfigFile.readLine()) != null)
                         new_compsLine =compsLine.replaceFirst(find_producttopstring, replacement_producttopstring);
                         out.write(new_compsLine);
                         out.write("\n");
                     out.close();
                     compsConfigFile.close();
                     compsFile.delete();
                     compsNewFile.renameTo(compsFile);
                 catch (IOException e)
            }Thanks a lot!

    Hi:
    I have a java program that searches and replaces
    strings in a file. It makes a new copy of the file,
    searches for a string in the copy, replaces the
    string and renames the new copy to the original file,
    thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but
    searching for "Topabcd" and replacing it doesnot work
    because there is a match for "abcd" in a different
    search scenario. How can I modify the code such that
    if "abcd" is already searched and replaced then it
    should not be searched for again or rather search for
    "abcd" as entire string and not if its a substring of
    another string.
    In the below code output, all instances of "abcd" and
    the ones of "Topabcd" are replaced by ABCDEFG and
    TopABCDEF respectively, whereas according to the
    desired output, "abcd" should be replaced by ABCDEFG
    and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
    String find_productstring = "abcd";
    String replacement_productstring = "ABCDEFG";
    compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    BufferedReader(compsXml);
    File compsFile =new File("file.xml");
    File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    FileWriter("file1.xml"));
    while ((compsLine =
    compsConfigFile.readLine()) != null)
    new_compsLine
    =compsLine.replaceFirst(find_productstring,
    replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
    catch (IOException e)
    //since "Topabcd" contains "abcd", which is
    the search above and hence the string "Topabcd" is
    not replaced correctly
    try
                   String find_producttopstring = "Topabcd";
    String replacement_producttopstring =
    topstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    gFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    dWriter(new FileWriter("file1.xml"));
    while ((compsLine =
    compsLine = compsConfigFile.readLine()) != null)
    new_compsLine
    new_compsLine
    =compsLine.replaceFirst(find_producttopstring,
    replacement_producttopstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
                 catch (IOException e)
    Thanks a lot!I tried the matches(...) method but it doesnt seem to work.
    while ((compsLine = compsConfigFile.readLine()) != null)
    if(compsLine.matches(find_productstring))
         System.out.println("Exact match is found for abcd");
         new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
         else
         System.out.println("Exact match is not found for abcd");
         out.write(compsLine);
         out.write("\n");

  • File rename doesn't add leading zeros to renaming files sequence? And a pat on the back to the LR de

    First of all, LR truly rocks. Any Adobe folk reading this, please take this note as a massive pat on the back for your team. There's a lot of childish and naive negativity from people posting in this forum. And I suspect from folk who are not really your key market for this app. I feed my kids by running a photography business and have been shooting digital since the early 90s...ya know...
    LR will be looked at as a massive sea change in the development of digital photography. The first time the entire workflow process is truly viable from end to end. What will make LR the ultimate winner in it's field is simply the integration with Photoshop. Aperture, Capture One etc cannot ever beat LR regarding this and so, just like the way that Excel and Word and Powerpoint all work together and everyone uses them, LR will inevitably become the de facto standard way of managing RAW images for pro photographers.
    Even with the few bugs (specifically file movingon Mac OS10.4.9) LR has shaved HOURS off our workflow. We shoot around 250 gigs of images a month in our weddings and event business. Now all of our editors use LR. No more Capture One etc for us.
    Here's the question - There seems to be no way to add leading zeros to a file rename command. So if you rename a batch of images they appear as 1,2,3,4,5,6,7,8,9,10,11,12 etc so now when I look at them in Bridge or other apps, they are now sorted 1,10,11, etc
    Now let me tell ya this is a pain.
    Any comments or comfort that is is a known issue would be appreciated. All we want is a way to have the rename add the leading zeros like most other apps do...
    Best to all
    William Henshall
    www.californiaweddingphotos.com
    PS By the way, I am a HARD *** about shoddy unstable software sold to pro photographers as the "prefect solution" that doesnt work as advertised...I am that guy that the tech support guys at certain companies dread. Yep, I simply expect an app to do what it says, just like the car I buy. I once resorted to sending the CEO of a certain software company an invoice for my time restarting, reinstalling the OS and bug finding another similar app. You can image, I got a personal call...heh...

    William-
    <br />
    <br />I just changed a folder of 85 images' names, and typed in 001 as my starting number. While no zeroes were prepended, the pix show up in order both in the Finder and in Bridge CS3.
    <br />
    <br />Say a bit more about file moving on your Macs.....
    <br />
    <br />
    <span style="color: rgb(102, 0, 204);">John "McPhotoman"</span>
    <font br="" /></font> color="#800000" size="2"&gt;~~ John McWilliams
    <br />
    <br />
    <br />
    <br />MacBookPro 2 Ghz Intel Core Duo, G-5 Dual 1.8;
    <br />Canon DSLRs

  • Replace specific string in a file while reading it

    Hi,
    I am kind of an in between learner & intermediate programmer. I am trying to replace a specific string pattern in a file by reading it using BufferedReader & BufferedWriter. I tried it for 2 days. Can anyone give me a piece of code which reads a file line by line and replaces the specific string format with other? I tried replaceAll(regex,replacement). Nothing is working.

    Hi Torajirou,
    Thanks for the code. But, looks like
    . But, looks like it is giving me a static method
    problem. It says a static method should beaccessed
    in a static way(f1.replace in main). Here is the
    code. Can you help me with this?
    import java.io.*;
    public class FileReadWrite1{
    public static void replace(File file, Stringregex,
    String replacement) throws
    FileNotFoundException,IOException {
         if (file == null) {
    throw new IllegalArgumentException("File should
    uld not be null.");
         if (!file.exists()) {
    throw new FileNotFoundException ("File does not
    not exist: " + file);
         if (!file.isFile()) {
    throw new IllegalArgumentException("Should not be
    be a directory: " + file);
         if (!file.canWrite()) {
    throw new IllegalArgumentException("File cannot be
    be written: " + file);
    File tempFile = File.createTempFile("temp",
    mp", "temp");
    BufferedReader reader = new BufferedReader(new
    (new FileReader(file));
    BufferedWriter writer = new BufferedWriter(new
    (new FileWriter(tempFile));
    try{
    while (true) {
    String line = reader.readLine();
    if (line == null) {
    break;
    line = line.replaceAll(regex,replacement);
    writer.write(line);
    writer.newLine();
    writer.close();
    reader.close();
    file.delete();
    tempFile.renameTo(file);
    }catch (Exception e) {
         System.out.println("Exception occured :"+e);
    public static void main(String[] args) {
         FileReadWrite1 f1 = new FileReadWrite1();
         File file = new File("C:\\Temp\\src1.txt");
         String regex = "us.mi.state";
         String replacement = "us.tx.state";
         f1.replace(file,regex,replacement);
    }when I wrote it, I was sober and bored
    now I'm drunk and amused
    god
    did you try and remove the magic "static" keyword ?
    I wrote it static because I didn't refer to any class
    member when I wrote it and that's what I felt
    compelled to do, though I feel nowadays writing
    anyting static suggests some design mistake
    somewhere
    blahblahblahblahblahs/blahblahblahblahblah/blahblahblahblahblahblah
    (forgot a "blah")

  • Replace String within a file

    i want to replace a string within a file
    there is NO GUI ..
    i take in mind two approaches
    1) hold the file content in memory
    and rewrite the file
    2) write the new data to a new file.
    and then rewrite the original file
    any better ideas

    sorry, no..
    Your idea is kinda right if small file is within existance..
    Small file.
    Why not just use the filereader and filewriter? read the docs upon that
    Large file
    Why wont you create a string buffer, and parse the file chunk by chunk into that buffer one at a time. Then of course you saved the position of the character or word you wanted to apend or write, and you just write it back to that area.

  • Replace string in a file

    I want a java program can replace string in a file with given string.
    for example,
    my file is
    abc 100
    aaa 110
    ded 123
    replace aaa with mmm.
    my codes is reading line by line and looking for aaa ,if read_line.index("aaa")> -1,then write mmm and aaa.substring
    Do you have ant other solutions?is there any file class method I can use?
    cheers.

    String content = <get file content>;
    String newContent = content.replaceAll( "aaa", "I get my homework on java.sun.com" );
    if( !newContent.equals(content) )
       <rewrite file contents>

  • How to add header to a file in mapping

    Hi,
    I need to add header to a file , the header information i am getting is dynamic , it is an IP address of the m/c from where i received the file and keeps on changing.
    Can we add this information in the header in mapping or there is any other way to acheive this.This IP is used to make a lookup  at a  latter stage  for verification purpose.
    Regards,
    SRi

    Hi Sri,
    Write Java class or an ABAP class
    in Java class or ABAP class write logic to find the first word or line
    once you find that word in your incoming file, you need to replace with a string which has the static header+firstword what you have searched
    for exmple
    Incoming file
    abcd
    <abc>123</abc>
    <def>321</def>
    Your logic should find "abcd"
    String Header = "http://www.sap.sdn.com"
    String A = "abcd" (bcoz u kow u r searching for this word)
    now concat A+Header and return the string
    IF you are writing an ABAP or Java  class include this in Interface Mapping
    Hope this helps.

  • How to add other 2 control files at ASM in linux RAC

    Hi Experts,
    I am new for RAC .
    the vendor build a RAC for us. I found there are only one control file in system.
    we use oracle 10.2.0.4 at ASM with RAC in redhat linux 5.
    how to add 2 additional control file to ASM for RAC ?
    Please provide a procedur in detail.
    Thanks
    Jim

    Hi damorgan & Friends,
    I could not find some infomration to add control into ASM . I can do this job( see below procedure) in no ASM .
    My question, our database locates at ASM and control file with a system auto-number ( fully qualified filename ) as
    +DATA1/SALE/controlfile/current.256.690290159
    How do I physical copy and rename other 2 contril file in directory and modify location in pfile?
    I saw some paper to use request as an alias (such as +dgroup2/control/ctl.f). i can not image to copy/rename control.
    Please help me!!
    Thanks
    Jim
    ========added control file for no ASM database and works=====================
    1)
    SQL> create pfile from spfile;
    File created.
    2)
    SQL> show parameter control_file
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string C:\ORADATA\ORCL\CONTROL01.CTL
    3)
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    4) modify pfile add additional control file2/3 as
    control_files='C:\Oradata\ORCL\control01.ctl','C:\Oradata\ORCL\control02.ctl','C:\Oradata\ORCL\control03.ctl'
    and physical copy control01.ctl and raname as control02.ctl,control03.ctl
    5)
    SQL> startup pfile='C:\oracle\product\10.2.0\db_2\database\initORCL.ora';
    ORACLE instance started.
    Total System Global Area 167772160 bytes
    Fixed Size 1247900 bytes
    Variable Size 62915940 bytes
    Database Buffers 100663296 bytes
    Redo Buffers 2945024 bytes
    Database mounted.
    Database opened.er database mount;
    6)
    SQL> Create spfile from pfile='C:\oracle\product\10.2.0\db_2\database\initORCL.ora';
    File created.
    7) check control file info under pfile environment
    SQL> show parameter control_file
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string C:\ORADATA\ORCL\CONTROL01.CTL,
    C:\ORADATA\ORCL\CONTROL02.CTL
    , C:\ORADATA\ORCL\CONTROL03.CT
    L
    8)SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    9) startup as spfile environment.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 167772160 bytes
    Fixed Size 1247900 bytes
    Variable Size 62915940 bytes
    Database Buffers 100663296 bytes
    Redo Buffers 2945024 bytes
    Database mounted.
    Database opened.
    10) check control info for spfile environment
    SQL> show parameter spfile
    NAME TYPE VALUE
    spfile string C:\ORACLE\PRODUCT\10.2.0\DB_2\
    DATABASE\SPFILEORCL.ORA
    SQL> show parameter control_file
    NAME TYPE VALUE
    control_file_record_keep_time integer 7
    control_files string C:\ORADATA\ORCL\CONTROL01.CTL,
    C:\ORADATA\ORCL\CONTROL02.CTL
    , C:\ORADATA\ORCL\CONTROL03.CT
    L

  • Search for a String in a File?

    hi all
    is there a methid in java with which i can open a file and
    search for a specified string in the file? i also have to
    replace the String then.
    Thanks angela

    There is no magic method that can do all this for you. First you need to create an inputstream from the file you want to read. Then you can read it (without necessarily store the whole file in memory), until you find a match. If you want to replace the string with another string of the same length, you can use RandomAccessFile. If not, then you will have to move all the rest of the file forward or backwards when you replace the string, or write the whole file modified to a new file and then delete the old file before you rename the new updated file.
    Or you can depending on what you do, append changes to the end of the file, more or less like what is done with Word documents. And then only once in a while update the file with all the appended changes.

  • Files renaming themselves

    I have had on ongoing problem with files renaming themselves most often with a numeric file name. It has happened with Quark , Illustrator and Photoshop files. There is no pattern... it happens randomly at different times. File names are less than 31 characters. Sometimes when I have linked files in Quark from Photoshop, the linked names willl change but not neccessarily the file name itself on the hard drive. Sometimes both names change, sometimes only the linked name will change in the usage box in Quark, sometimes the file will rename itself on the hard drive. For instance, a file recently named SPI6007_past_presentadult.qxd has renamed itself on my hard drive as QXP-1055969291.qxp In this case, it has created another file and did not replace the original. This has been an ongoing issue and I have worked at several agencies with several different computers and several different Mac Operating Systems. Any help is much appreciated. Out IT guys are stumped.

    Gary,
    I have had this problem over our network. I transfered a folder with a Quark file and about 50 pieces of art. Most of the art had changed to numbers. I would have been sunk if it were not for the folder still on the server. Still had a lot of changing to do. Other computers on network have not been affected--yet. I have had problems with Quark, Photoshop and Illustrator files changing from app files to Unix files. I have searched the discussion pages and have not found a beneficial solution. One thing I have done is to install Quark, Photoshop and Illustrator on our server. This forces the system to recognize the icons and . I am telling our artists to let the program add the extension and for them not to delete it. This will solve the problem from this point on. We still have lots of art that do not have extensions and will cause problems. One site that was somewhat helpful that I would recommend is www.thexlab.com. You will find some information there about resetting launch services. Good luck.

  • BUG: Multiple file renaming

    I believe I have found a bug in the file renaming routine in LR:
    I store related .jpg and .nef (raw) files in the same folder. Each .nef has a corresponding .jpg version with the same file name.
    I wanted to rename all the files in one folder by selecting all, pressing F2 and entering the file name settings I wanted.
    When I started the process, it successfully renamed the first .jpg but stopped with an error, saying that the next file (the corresponding .nef file) could not be found.
    What happened was the following: when LR renamed the .jpg, it also renamed the corresponding .nef (which I personally think is great). But when the renaming routine moved to the next file on the list, it couldn't find it, because it was the .nef file already renamed together with the .jpg file.
    Ha, I thought, you're not outsmarting me! I then selected the .jpgs only and tried to rename them all, hoping that the .nefs would be processed as well.
    That worked fine, BUT: the .nefs were then shown in the library with the '?' sign on them, signaling that LR could not locate them anymore.
    What happened? LR successfully renamed .jpgs and .nefs, but did not update the library file for the nefs (ONLY), still showing them with their old file names, when in effect they had been renamed (as I could see in Windows Explorer).
    To summarize: you can rename a folder full of .jpgs and .nefs by just selecting the .jpgs, but LR will update the new file name in its library only for the .jpgs. For the .nefs, you need to hold LRs hand and point it to the new file name for each individual file.
    Unless I miss something basic here, I think that's something which should be fixed.
    Christian Spyr

    Hi Chris,
    fotunately I already made such a modification to ADDT´s predecessor "MX Kollection", and as the core files didn´t change, it will assumingly work the same:
    1. add the following function to the file "includes/common/KT_functions.inc.php":
    replace all chars from uploaded filenames other than alpha-numeric and "_" and "-" and "." with an underscore (_)
    function KT_websafe_filename($text) {
    return preg_replace("/[^a-zA-Z0-9\-_\.]+/", "_", $text);
    2. change line 120 in file "includes/common/lib/file_upload/KT_FileUpload.class.php":
    old: $fileName = KT_replaceSpecialChars($fileName, 'filter');
    new: $fileName = KT_websafe_filename($fileName, 'filter');
    This modification will of course *always* be renaming the uploaded file accordingly -- but you´ll need no fancy trigger and anything else.
    Please backup the 2 original files !!
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • File rename app

    I created a small application to rename a file using 2 classes. Both compile, and both run, but when I test it on a file, it doesn't rename it.
    Heres the application file:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import java.text.*;
    public class FileRenameTool {
    //String for the label
    private static String NewFileNameString = "New File Name: ";
    public Component createComponents() {
    //Create the label, field and button.
    JLabel TextFieldLabel = new JLabel(NewFileNameString);
    final JTextField FileNameField = new JTextField(20);
    JButton RenameFile = new JButton("Rename File");
         RenameFile.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
              String text = FileNameField.getText();
    // create file rename object
    FileRename fr = new FileRename();
    // create string values for file names
    String OldFile = "C:\\TestFile01.txt";
    String NewFile = text;
              fr.RenameFile(OldFile, NewFile);
    //Layout the text fields in a panel.
    JPanel fieldPane = new JPanel();
    fieldPane.setBorder(BorderFactory.createEmptyBorder(
    30, //top
    30, //left
    10, //bottom
    30) //right
    fieldPane.setLayout(new GridLayout(0, 1));
    fieldPane.add(TextFieldLabel);
    fieldPane.add(FileNameField);
    fieldPane.add(RenameFile);
              return fieldPane;
         // main method
    public static void main(String[] args) {
         try {
    UIManager.setLookAndFeel(
    UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {}
    //Create the top-level container and add contents to it.
    JFrame frame = new JFrame("FileRename");
    FileRenameTool rntool = new FileRenameTool();
    Component contents = rntool.createComponents();
    frame.getContentPane().add(contents, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
    ...and here is the class it is calling:
    import java.io.*;
    public class FileRename {
         public String OldFile;
         public String NewFile;
         public void RenameFile(String OldFile, String NewFile) {     
              this.OldFile = OldFile;
              this.NewFile = NewFile;     
              try {
                   File file = new File(OldFile);
                   File NewName = new File(NewFile);
                   file.renameTo(NewName);
              catch(Exception e) {
                   e.printStackTrace();
    Thanks in advance for your help.

    I advise you to use instead of renameFile, use a method called "renameTo" it has the following format file1.renameTo(file2), it works correctly becuse i have used it before. i am here for any question.

  • How to add a new mapping file

    I am using SSIS (SQL Server 2008) to replicate from an ODBC source (using .NET Framework Data Provider for ODBC) to SQL Server.
    I am using the Import/Export Wizard and encountering the problem described in KB 152728:
    SSIS 2008 Import Export Wizard can show numbers instead of data type
    http://support.microsoft.com/kb/2152728
    I am trying to add a new mapping file in C:\Program Files\Microsoft SQL Server\100\DTS\MappingFiles, but it appears that the new mapping file is not being noticed by the wizard - the dialog box of the wizard (COnvert Types without Conversion Checking) still
    displays
    Source Information:
    Cannot locate the mapping file to map the provider types to SSIS types
    I tried creating a new mapping file by copying an existing one (DB2ToMSSql10.XML), renaming it ODBCToMSSql10.XML (as near as I can tell, the filename doesn't matter), and changing the SourceType line:
    SourceType="System.Data.Odbc.OdbcConnection"
    Is there anything else I need to do?  I was expecting I might find a file that SSIS uses to figure out which mapping file to use, but I was unsuccessful, so I think it looks at the SourceType line.
    The following is the full output of the dialog - perhaps I should be modifying DTS\binn\DtwTypeConversion.xml instead?  But that seems messier than creating a new file in DTS\MappingFiles:
    [Source Information]
    Cannot locate the mapping file to map the provider types to SSIS types
    [Destination Information]
    Destination Location : (local)
    Destination Provider : SQLNCLI10
    Mapping file (to SSIS type): c:\Program Files\Microsoft SQL Server\100\DTS\MappingFiles\MSSQLToSSIS10.XML
    [Conversion Table]
    SSIS conversion file: c:\Program Files\Microsoft SQL Server\100\DTS\binn\DtwTypeConversion.xml

    Hi, did you ever get a solution to this issue? I'm having a similar challenge trying to create a new mapping file which is not being detected by the import wizard.
    Please let me know.
    Gregg

Maybe you are looking for