Changing the file name n Flat file Extraction

Hi,
Currently i am using flat file extraction for my forecast data and i am sending the file through application server.
I have created directory successfully and now everyday morning i receive a file thru FTP server with name 20060903.csv and this name is based on one field in my flat file data.  ex. /interface/asf/20060903.csv
During mid off month we have cut off date, and this cut off date varies for each month. During this time file name changes in the FTP and a file with different name i.e 20061002.csv will be existing in the application server.
Now in the infopackage i also need to set the deletion settings like if the file name is same delete the previous requests. I could achieve this if i could get the file name changed.
Lets say if i am not chnaging the file name how do i set deletion condition, like it should not delete if the field(scenario) changes. ie from 20061002 to 20061101. I should have only one file for 20061002 and one file for 20061101 etc... If the scenario is same it should delete.
Any one kindly advise. Very urgent and critical.
Tks & regards,
Bhuvana.

Hi Bhunva,
Try the following abap code in routine under External data tab in infopackage.
data: begin of i_req occurs 0,
      rnr like RSICCONT-rnr,
      end of i_req.
select * from RSICCONT UP TO 1 ROWS
                  where ICUBE  = <datatargetname>
                  order by TIMESTAMP descending.
  i_req-rnr = rsiccont-rnr .
  append i_req.
  clear i_req.
endselect.
loop at i_req.
  select single * from RSSELDONE where RNR eq i_req-rnr and
                                   filename = p_filename.
  if sy-subrc = 0.
    CALL FUNCTION 'RSSM_DELETE_REQUEST'
      EXPORTING
        REQUEST                    = i_req-rnr
        INFOCUBE                   = <datatargetname>
      EXCEPTIONS
        REQUEST_NOT_IN_CUBE        = 1
        INFOCUBE_NOT_FOUND         = 2
        REQUEST_ALREADY_AGGREGATED = 3
        REQUEST_ALREADY_COMDENSED  = 4
        NO_ENQUEUE_POSSIBLE        = 5
        OTHERS                     = 6.
    IF SY-SUBRC <> 0.
      MESSAGE ID sy-MSGID TYPE 'I' NUMBER sy-MSGNO
          WITH sy-MSGV1 sy-MSGV2 sy-MSGV3 sy-MSGV4.
    else.
      message i799(rsm1) with i_req-rnr 'deleted'.
    ENDIF.
endif.
let me know if you get any problem in this logic.
regards,
Raju

Similar Messages

  • How we will change the lowercase data in flat file to uppercase

    How can i change the lowercase date in flat file  after uploaded, out put should be uppercase.

    Hi ramana,
    See the example.
    DO.
       READ DATASET s_filename INTO I_TEMP.
       IF SY-SUBRC <> 0.
        EXIT.
       ELSE.
         move I_TEMP to I_FINALTAB.
         append I_FINALTAB.
         clear I_FINALTAB.
      ENDIF.
    ENDDO.
         In the above code we are moving the data form file to i_temp and i_temp to I_FINAL.
    Here before moving to i_FINAL.
    use  TRANSLATE i_temp to UPPSERCASE.
    Then move to i_final.
    Pls. reward if useful.

  • Changing the display name of project file folders for TOC

    I'm interested in changing the display names of the project file folders for my TOC. For example, I want to name the folder "01-intro" so that it is short and lowercase. But I'd like the TOC to say "Introduction to the System." I know I can manually rename the folder in the TOC either through its properties or by right-clicking => Rename, but I auto-create the TOC occasionally and I don't want to have to rename every folder every single time.
    Does anyone know if there is a way to set a persistent property for the folder so that its display name in the TOC is different? I am using RoboHelp 9. I saw an option called "Detail" in the properties of the WebHelp layout in RoboHelp 8 that seems like it may have done that, but I no longer see this property in RoboHelp 9.
    Any assistance would be much appreciated. Thank you.

    I think the lack of response confirms that if you are going to use Auto Create, you have to accept the way it is.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How I may change the encoding names for downloaded files?

    I have some problem with encoding when I download files from russian sites. The downloaded files look like this "ìîé êàáèíåò - èíôîðìàöèÿ"

    Firefox, as is, will only download the file. You can choose where the file is
    saved, but that's it.
    Go to the '''''[https://addons.mozilla.org/en-US/firefox/ Mozilla Add-ons Web Page]''''' {web link}
    (There’s a lot of good stuff here) and search for '''download managers.'''
    Many of them give you a chance to change the file name.

  • Omit the Open Hub control file 'S_*' for flat file extracts

    Hi Folks,
    a quick question is it somehow possible to omit the control file generation for flat file extracts.
    We got some unix scripts running that get confused by the S_* files and we where wondering if we can switch the creation of those files off.
    Thanks and best regards,
    Axel

    Hi,
    However, the S_ (structure) file does not reflect the proper structure. The S_ file lists all fields sorted in alphabetical order based on the field name, instead of listing all fields in the correct order that they appear in the output file.
    As I know and checked this is not the case. The S_ file has the fields in the order of infospoke object sequence ( and in transformation tab, source structure).
    I would suggest you to control it again.
    Derya

  • I can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name

    can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name. My original external has an error and needs to be reformatted but I dont want to lose this informations its my entire Itunes library.

    Sounds like the source drive is formatted as case sensitive and the destination drive is not. The preferred format for OS X is case insensitive unless there is a compelling reason to go case sensitive.
    Why can't you change the filename? Is it because the source drive is having problems?  If so is this happening with only one or two or a few files? If so the best thing would be to copy those over individually and then rename them on the destination drive.
    If it is more then you can do manually and you can't change the name on the source you will have to reformat the destination as case sensitive.
    Btw this group is for discussion of the Support Communities itself, you;d do better posting to Lion group. I'll see if a host will move it.

  • Powershell: How to change the header name in a imported CSV file

    HI All,
    I have a csv file in which I want to change the headers names in powershell.
    oldnames are name,id
    newnames I want to give are: company and transit respectively.
    Following is what I wrote in script:
               $a = import-csv .\finalexam\employees.csv -header name,id'
                       foreach ($a in $as[1-$as.count-1])  // I used 1 here because I want it to ignore the  exiting headers.
                      { $_.name -eq company, $_.id -eq transit}
    I think this not entirely correct way to do this. Can someone show me how to fix this.
    Regards
    SQL 75

    If you're not an experienced PowerShell programmer, I recommend editing the file in a text editor and changing the name that way.
    -- Bill Stewart [Bill_Stewart]

  • Changing the field name at runtime in rpt file

    Hi everybody
    I'm using C# and Crystal Report XI (Deverlop license) to develop windows application in VS.net 2003.
    Please help me to change the field name of the bounded column of Crystal report file at the runtime.
    (In some case client's database had changed the structure as fieldname, fieldtype. Then they request a utility to change the field names in the .rpt file programmatically )
    Thanks
    GiangSon
    My email address: [email protected]

    user11200661 wrote:
    That's fine but still i want to prefix the schema name within the .sql file. My .sql should contain the name of that parameter only as i want to get that parameter replaced by the schema name at runtime. Some other users are using the same .sql file and they have access to that specific schema only. i want to make the .sql file more general so that it can be used by everyone without altering it every time.Sorry, your requirement no longer makes sense.
    If people have to access a specific schema because they need the script for general use, then you will have to hard code the schema name into it.
    If the script is to prompt for the schema name and connect to that schema and then use that schema name inside the called sql script, then people would not be able to use it generically, as it would be reliant upon the schema name being passed in.
    It sounds as if you're trying to write one generic thing that needs to do two different tasks.
    Just have two scripts and make life simple.

  • Changing the form name in a .js file

    hi,
    I am trying to use .js files instead of script in the jsp page with the use of
    <script src="root/scripts/foo.js"></script>.
    This foo.js has got the functions which access the information of the form in which they are included. So if I specify a dummy form name in the script, while a page (say "thisPage.jsp" with a form name "thisForm")is loading I would like all the references in the javascript file which are like this document.someFormName.---- to document.thisForm.--.
    How do I do this.
    regards,
    f

    actually, what you asked is completely a Javascript question. There's nothing JSP related about it. Nothing.
    Your actual question, the one you actually posted, was answered correctly. If your question was wrong, then that's not our problem.
    What does concurrent users have to do with anything anyway? Are they all using the same PC and browser instance at the same time? I doubt it. All the code you are referring to is Javascript code, and that will only run in the browser, not on the server, so concurrent user actions have nothing to do with it.
    If you want to change the form name in JSP, then you can do so when writing the page:
    <form name="<%= theFormName %>" action="..." method="POST">
    Otherwise, 'document.'+name ..., eval(), all that is Javascript, not JSP, has nothing to do with JSP or other users.
    So in conclusion, I don't think it's us people that posted answers interpretting things wrong, it's you who doesn't have any idea what he's doing.

  • Changing the Tape Name of a media file

    I need to change the Tape Name of an hour long media file that I captured a while ago.
    (Gave it the wrong name and didn't notice til today.)
    Is this possible?
    Can I use the new name if sometime down the line I need to recapture the media?
    Or are my only options to recapture or use the old name?
    I haven't done anything with the file, haven't started the edit yet.
    I need to change the Tape Name as well as the File Name and move it into a new FCP project.

    I wish I could share your conviction on this working. I have had many instances of reel number changes not following through the workflow. (afaik reel number info is not embedded into the quicktime file, it remains within the fcp project file. how can you see its there in the quicktime file Michael? ) only too frequently do reel numbers get corrected and then revert to the original bad reel number.
    I know this can be rectified by entering the right reel number in the first place, but human nature being what it is, especially when a big team is involved in ingesting footage, errors will creep in.
    our solution here is to maintain a clear trail to the source tape by prefixing the tape no into the name column.
    FCP's media managing being what it is, this has worked reliably for us.
    regards
    andy
    mac pro 2,66, 4gig ram, quad 2.5ghz g5, 4.5 gig ram,   Mac OS X (10.4.8)   G4 powerbook 1.67gHz, 2gig ram

  • Why do I receive the exclamation point when I just change the album name? File goes missing?

    I keep all of my itunes media on an attached network hard drive.  Had no problems for months but over the past 45 days I've noticed that material has started to go missing that I know I did not delete.  I have found no malware on my system.
    I read a script to tell me all the files that had an exclamation point.  There were some TV shows (an entire season gone missing) and some CDs.
    I just did a test and imported a CD.  I then clicked "get info" and changed the name of the album.  Immediately I received the exclamation point and when I tried to find the original file it is gone.  I have no idea where the file has gone to.  I've tried searching, looking around to find it, and I can't. 
    Why is itunes having this behavior?  How is the file being deleted?  Any other thoughts or ideas of what I should do to stop this?
    I've also sent a support request to the hard drive mfg (lacie) but I'm not sure I'll get much help there.
    Thanks.

    More info:  I just ran the same test two ways.  One, I had some files on my desktop, run a script to move these files to the "automatically add to itunes" folder, the files move just fine to my external hard drive and to itunes.  The file plays just fine and the "get info" tab shows it is playing the file from the external hard drive where the file was moved to (not copied).  But, as soon as I change the artist name or the album, the file goes missing and I get the exclamation point.
    I ran the same test by putting the files on my desktop, but instead of moving the file to the "automatically add to itunes folder" I just double clicked the file to play it.  I let itunes add a copy and organize my folders.  This time, the file would have been copied (not physically moved) and I see itunes is playing the new copied version.  This time, when I try to change the artist name or album, I have no problems.
    I've never encountered this before.  Any info?  Thanks.

  • Need help changing the setting to preview entire file names

    Using Leopard, I would like to to be able to read the entire name of a file.
    For example, my files might say (File 2.....609). What the file is named is File 2 Graphs 6209. How can I set up Leopard to allow me to read the entire file, so I don't have to guess the file?

    Ah! I tend to avoid using column view for folders containing items with long names, because it increases the amount of horizontal scrolling needed to see everything, & because I'm usually interested in seeing & sorting items by the non-name columns available in list view.
    FWIW, I tried the column view drag handle double click tip on one of the folders containing some of my extra long named items & it does expand to show the entire name, but I don't care for the result: the Finder window expands horizontally so much that it won't all fit within even a 24" widescreen display! So not only do I have to scroll the window's content horizontally to see everything, I have to move the window partially offscreen to do so. That is too much of a chore to make this a very good alternative for long path names.
    It occurs to me that there might be a more elegant, subtle, & "it just works" Apple-like solution possible: instead of just abbreviating the displayed item name by replacing enough of the middle characters of the name with an ellipsis to make it fit, it would be cool if this were adaptive & tried first to abbreviate the non-unique parts of the name, relative to all the items in the column. So if say 3 files in a view contained the same 12 character sequence, that sequence would appear with the same abbreviation in each file, more frequently preserving the display of the unique parts of each file name.
    Does this make sense?

  • Problem in the BDC program to upload the data from a flat file.

    Hi,
    I am required to write a BDC program to upload the data from a flat file. The conditions are as mentioned below:-
    1) Selection Screen will be prompted to user and user needs to provide:- File Path on presentation server (with F4 help for this obligatory parameter) and File Separator e.g. @,#,$,%,... etc(fields in the file will be separated by using this special character) or fields may be separated by tab(tab delimited).
    2) Finally after the data is uploaded, following messages need to be displayed:-
    a) Total Number of records successfully uploaded.
    b) Session Name
    c) Number of Sessions created.
    Problem is when each record is fetched from flat file, the record needs to be split into individual fields separated by delimiter or in case tab separated, then proceeding in usual manner.
    It would be great if you provide me either the logic, pseudocode, or sample code for this BDC program.
    Thanks,

    Here is an example program,  if you require the delimitor to be a TAB, then enter TAB on the selection screen, if you require the delimitor to be a comma, slash, pipe, whatever, then simply enter that value.  This example is simply the uploading of the file, not the BDC, I assume that you know what to do once you have the data into the internal table.
    REPORT zrich_0001.
    TYPES: BEGIN OF ttab,
            rec TYPE string,
           END OF ttab.
    TYPES: BEGIN OF tdat,
           fld1(10) TYPE c,
           fld2(10) TYPE c,
           fld3(10) TYPE c,
           fld4(10) TYPE c,
           END OF tdat.
    DATA: itab TYPE TABLE OF ttab.
    data: xtab like line of itab.
    DATA: idat TYPE TABLE OF tdat.
    data: xdat like line of idat.
    DATA: file_str TYPE string.
    DATA: delimitor TYPE string.
    PARAMETERS: p_file TYPE localfile.
    PARAMETERS: p_del(5) TYPE c.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      DATA: ifiletab TYPE filetable.
      DATA: xfiletab LIKE LINE OF ifiletab.
      DATA: rc TYPE i.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        CHANGING
          file_table = ifiletab
          rc         = rc.
      READ TABLE ifiletab INTO xfiletab INDEX 1.
      IF sy-subrc = 0.
        p_file = xfiletab-filename.
      ENDIF.
    START-OF-SELECTION.
      TRANSLATE p_del TO UPPER CASE.
      CASE p_del.
        WHEN 'TAB'.
          delimitor = cl_abap_char_utilities=>horizontal_tab.
        WHEN others.
          delimitor = p_del.
      ENDCASE.
      file_str = p_file.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename = file_str
        CHANGING
          data_tab = itab.
      LOOP AT itab into xtab.
        CLEAR xdat.
        SPLIT xtab-rec AT delimitor INTO xdat-fld1
                                         xdat-fld2
                                         xdat-fld3
                                         xdat-fld4.
        APPEND xdat to idat.
      ENDLOOP.
      LOOP AT idat into xdat.
        WRITE:/ xdat-fld1, xdat-fld2, xdat-fld3, xdat-fld4.
      ENDLOOP.
    Regards,
    Rich Heilman

  • Is there a way to change the image numbers in a file in Aperture?

    Is there a way to change the image numbers in a file in Aperture? We shoot with two photographers and so the img numbers are not in order but I would like to have the photos in chronological order on the disc when I give it to them. Does anyone know how to do this? I have them all in order ready to go in Aperture but when I move them to the disc to be burned they default back to the img number order. Thanks for your help!

    What do you mean by "image number"? The file names like "IMG_7822.CR2" or "IMG_7822.jpg"?
    You can create custom names with appended numbers, when you export your image files to be saved on a disk.
    Sort your images by date in the browser, select them, then use the command "File > Export > Version" to write the files to the disk. Set the name format to "Custem Name with Index" or "Custom Name with Counter" to create numbered names in your current sort order.
    Regards
    Léonie

  • How to put the file name in notepad file

    dear frank,
    how to put the file name in notepad file via power shell. I mean i want to put the file name in that notepad file
    for example,
    my file name is ABL and in this file data is
    02/06/2015,180.00,182.00,176.01,180.50,1575500
    02/06/2015,4.20,4.20,4.20,4.20,500
    02/06/2015,113.50,113.70,112.91,113.09,157800
    02/06/2015,682.01,695.90,682.00,683.19,4250
    02/06/2015,213.98,215.00,213.00,214.87,326200
    02/06/2015,21.52,21.65,21.52,21.60,4000
    02/06/2015,111.00,111.25,108.25,108.91,17100
    02/06/2015,52.00,52.00,52.00,52.00,500
    and i want to data in this form
    ABL,02/06/2015,180.00,182.00,176.01,180.50,1575500
    ABL,02/06/2015,4.20,4.20,4.20,4.20,500
    ABL,02/06/2015,113.50,113.70,112.91,113.09,157800
    ABL,02/06/2015,682.01,695.90,682.00,683.19,4250
    ABL,02/06/2015,213.98,215.00,213.00,214.87,326200
    ABL,02/06/2015,21.52,21.65,21.52,21.60,4000
    ABL,02/06/2015,111.00,111.25,108.25,108.91,17100
    ABL,02/06/2015,52.00,52.00,52.00,52.00,500
    There are many file like this that i want to be edit
    plese tell me how can i do it, i think it is possible via windows power shell.
    thanks in advance.

    Hi
    Just for completeness, what version of VB.NET are you using?
    Here is a complete project to copy all the files with the added "ABL," at the start of each line.  You need to start a new Project with a BLANK default Form1, and replace all of Form1 code with the code below. When you run this project, you
    need to use the 2 buttons to set up the ORIGINAL file folder and a folder to place the copies. You need to check if the file EXTENSION is correct (I assumed txt), and check the text to add to each line is correct.  Once all is set up you should have a
    big red button to start the operation.
    NOTE: it is important that you try this out on a copy of some of the files to verify accuracy BEFORE trying on original files. Make sure you have a good back up of the original files before doing anything else.
    ' new project with default BLANK Form1
    ' replace all Form1 code with this code
    ' WARNING: make sure you have a backup of
    ' any files you use this application to
    ' operate on.
    Option Strict On
    Option Infer Off
    Option Explicit On
    Public Class Form1
    Dim OrigFileFolderPath As String = Nothing
    Dim CopyToFolderPath As String = Nothing
    Dim lab1, lab2, lab3 As New Label
    Dim tb1, tb2, tb3 As New TextBox
    Dim b1, b2, b3, b4 As New Button
    Dim fb As New FolderBrowserDialog
    Dim bgw As New System.ComponentModel.BackgroundWorker
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
    Me.Size = New Size(731, 300)
    With lab1
    .Text = "Original Files Folder Path"
    .Location = New Point(15, 5)
    End With
    With tb1
    .Width = 560
    .Location = New Point(10, 30)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
    End With
    With lab2
    .Text = "Copy Files to Folder Path"
    .Location = New Point(15, 125)
    End With
    With tb2
    .Width = 665
    .Location = New Point(10, 150)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
    End With
    With lab3
    .Text = "File Ext"
    .Location = New Point(600, 5)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    End With
    With tb3
    .Text = ".txt"
    .Width = 80
    .Location = New Point(590, 30)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .TextAlign = HorizontalAlignment.Center
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    End With
    With b1
    .Text = "Choose Original Files Folder Path"
    .AutoSize = True
    .Location = New Point(10, 65)
    End With
    With b2
    .Text = "Choose Copy Files to Folder Path"
    .AutoSize = True
    .Location = New Point(10, 185)
    End With
    With b3
    .Text = "DO THE COPY"
    .AutoSize = False
    .Size = New Size(240, 50)
    .BackColor = Color.Red
    .ForeColor = Color.White
    .Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
    .Location = New Point(420, 80)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    .Visible = False
    End With
    With b4
    .Text = "CANCEL JOB"
    .AutoSize = False
    .Size = New Size(240, 50)
    .BackColor = Color.Red
    .ForeColor = Color.White
    .Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
    .Location = New Point(420, 80)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    .Visible = False
    End With
    Me.Controls.AddRange({lab1, lab2, lab3, tb1, tb2, tb3, b1, b2, b3, b4})
    With bgw
    .WorkerReportsProgress = True
    .WorkerSupportsCancellation = True
    End With
    AddHandler bgw.DoWork, AddressOf bgw_DoWork
    AddHandler bgw.RunWorkerCompleted, AddressOf bgw_Completed
    AddHandler b1.Click, AddressOf b1_Click
    AddHandler b2.Click, AddressOf b2_Click
    AddHandler b3.Click, AddressOf b3_Click
    AddHandler b4.Click, AddressOf b4_Click
    End Sub
    Private Sub b1_Click(sender As Object, e As EventArgs)
    fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
    fb.ShowNewFolderButton = False
    Dim r As DialogResult = fb.ShowDialog
    If r = Windows.Forms.DialogResult.OK Then
    tb1.Text = fb.SelectedPath
    If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
    If tb3.Text = Nothing Then
    redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
    If tb3.Text = Nothing Then GoTo redo
    End If
    b3.Visible = True
    Else
    b3.Visible = False
    End If
    End If
    End Sub
    Private Sub b2_Click(sender As Object, e As EventArgs)
    fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
    fb.ShowNewFolderButton = True
    Dim r As DialogResult = fb.ShowDialog
    If r = Windows.Forms.DialogResult.OK Then
    tb2.Text = fb.SelectedPath
    If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
    If tb3.Text = Nothing Then
    redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
    If tb3.Text = Nothing Then GoTo redo
    End If
    b3.Visible = True
    Else
    b3.Visible = False
    End If
    End If
    End Sub
    Private Sub b3_Click(sender As Object, e As EventArgs)
    b3.Visible = False
    b4.Visible = True
    If Not tb3.Text.StartsWith(".") Then tb3.Text = "." & tb3.Text
    bgw.RunWorkerAsync()
    End Sub
    Private Sub b4_Click(sender As Object, e As EventArgs)
    bgw.CancelAsync()
    End Sub
    Private Sub ReadPWFile(fn As String)
    Dim filename As String = My.Computer.FileSystem.GetName(fn)
    Dim barename As String = IO.Path.GetFileNameWithoutExtension(fn)
    Dim copyto As String = tb2.Text & "\" & filename
    Dim line As String = Nothing
    Dim lines As New List(Of String)
    Using sr As IO.StreamReader = New IO.StreamReader(fn)
    Do
    line = sr.ReadLine()
    If Not line = Nothing Then
    lines.Add(barename & "," & line)
    End If
    Loop Until line = Nothing
    End Using
    Using sw As IO.StreamWriter = New IO.StreamWriter(copyto)
    For Each s As String In lines
    sw.WriteLine(s)
    Next
    End Using
    End Sub
    Private Sub bgw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
    Dim ftc As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(tb1.Text)
    For Each f As String In ftc
    If bgw.CancellationPending Then
    e.Cancel = True
    Exit For
    End If
    Dim ex As String = My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower
    If My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower = tb3.Text.ToLower Then
    ReadPWFile(f)
    End If
    Next
    End Sub
    Public Sub bgw_Completed(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs)
    tb1.Text = Nothing
    tb2.Text = Nothing
    b3.Visible = False
    b4.Visible = False
    MessageBox.Show("Finished copying files", "Job Completed")
    End Sub
    End Class
    Regards Les, Livingston, Scotland

Maybe you are looking for