delete local files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rscott

    #1

    delete local files

    Looking for help on how to create a page for a client that will find a
    specific file on a local drive, upload it to the server, and then delete the
    local copy, or allow them to respond and delete tehe local file.
  • vMike

    #2
    Re: delete local files


    "rscott" <rscott@discuss ions.microsoft. com> wrote in message
    news:39979F8C-2FE0-4799-9B26-44BD349909D6@mi crosoft.com...[color=blue]
    > Looking for help on how to create a page for a client that will find a
    > specific file on a local drive, upload it to the server, and then delete[/color]
    the[color=blue]
    > local copy, or allow them to respond and delete tehe local file.[/color]

    You can try something like this snip to build a list of files in a table.
    Then you can bind the table to datagrid or datalist, from there you can
    create code to delete, copy etc your files.

    Dim strarr as string()

    dim dt as New datatable()
    Dim myDataColumn1 As DataColumn= new datacolumn("Fil eName")
    myDataColumn1.d atatype=System. Type.GetType("S ystem.String")
    Dim myDataColumn2 As DataColumn= new datacolumn("Las tWriteTime")
    myDataColumn2.d atatype=System. Type.GetType("S ystem.DateTime" )

    dt.columns.add( myDatacolumn1)
    dt.columns.add( myDatacolumn2)

    strarr = Directory.GetFi les(strBindPath ,"*???????????c art.xml") 'get list
    of file and puts them in the array variable

    'this iterates through the list and puts the file information in a datatable
    Dim i as int32
    for i = 0 to strArr.getupper bound(0)
    dim fi as new fileinfo(strArr (i))
    dim drw as datarow
    drw = dt.newrow()
    drw("FileName") = strArr(i)
    drw("LastWriteT ime") = fi.lastwritetim e
    dt.rows.add(drw )
    next i


    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: delete local files

      vMike <MicZhaYel.GeoZ rgeY@noYandZ.ge ZwaYrrenZ.com> wrote:[color=blue]
      > "rscott" <rscott@discuss ions.microsoft. com> wrote in message
      > news:39979F8C-2FE0-4799-9B26-44BD349909D6@mi crosoft.com...[color=green]
      > > Looking for help on how to create a page for a client that will find a
      > > specific file on a local drive, upload it to the server, and then delete[/color]
      > the[color=green]
      > > local copy, or allow them to respond and delete tehe local file.[/color]
      >
      > You can try something like this snip to build a list of files in a table.
      > Then you can bind the table to datagrid or datalist, from there you can
      > create code to delete, copy etc your files.
      >
      > Dim strarr as string()
      >
      > dim dt as New datatable()
      > Dim myDataColumn1 As DataColumn= new datacolumn("Fil eName")
      > myDataColumn1.d atatype=System. Type.GetType("S ystem.String")
      > Dim myDataColumn2 As DataColumn= new datacolumn("Las tWriteTime")
      > myDataColumn2.d atatype=System. Type.GetType("S ystem.DateTime" )
      >
      > dt.columns.add( myDatacolumn1)
      > dt.columns.add( myDatacolumn2)
      >
      > strarr = Directory.GetFi les(strBindPath ,"*???????????c art.xml") 'get list
      > of file and puts them in the array variable[/color]

      Directory.GetFi les is going to read it from the server though, not the
      local drive. I believe the OP wants the client-side files to be read
      and deleted. This *may* be possible with JavaScript, but I doubt it, to
      be honest.

      --
      Jon Skeet - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      • Cor Ligthert

        #4
        Re: delete local files

        RScott,

        There is no way to let you look (using a modern browser) on the client
        without an authorized by the user added activeX or Java pluggin. And that is
        more and more protected, so when you make it you do not know for how long.

        Cor


        Comment

        • Cor Ligthert

          #5
          Re: delete local files

          Jon,

          One of the major security issues with the creation of JavaScript (and
          VBScript) was that with the language you never could reach the hard disk .
          That is why a lot of people started to hate it, however luckily it was a
          good decision in my opinion.

          Cor


          Comment

          • vMike

            #6
            Re: delete local files


            "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
            news:MPG.1b8bdd ae253490eb98b19 5@msnews.micros oft.com...[color=blue]
            > vMike <MicZhaYel.GeoZ rgeY@noYandZ.ge ZwaYrrenZ.com> wrote:[color=green]
            > > "rscott" <rscott@discuss ions.microsoft. com> wrote in message
            > > news:39979F8C-2FE0-4799-9B26-44BD349909D6@mi crosoft.com...[color=darkred]
            > > > Looking for help on how to create a page for a client that will find a
            > > > specific file on a local drive, upload it to the server, and then[/color][/color][/color]
            delete[color=blue][color=green]
            > > the[color=darkred]
            > > > local copy, or allow them to respond and delete tehe local file.[/color]
            > >
            > > You can try something like this snip to build a list of files in a[/color][/color]
            table.[color=blue][color=green]
            > > Then you can bind the table to datagrid or datalist, from there you can
            > > create code to delete, copy etc your files.
            > >
            > > Dim strarr as string()
            > >
            > > dim dt as New datatable()
            > > Dim myDataColumn1 As DataColumn= new datacolumn("Fil eName")
            > > myDataColumn1.d atatype=System. Type.GetType("S ystem.String")
            > > Dim myDataColumn2 As DataColumn= new datacolumn("Las tWriteTime")
            > > myDataColumn2.d atatype=System. Type.GetType("S ystem.DateTime" )
            > >
            > > dt.columns.add( myDatacolumn1)
            > > dt.columns.add( myDatacolumn2)
            > >
            > > strarr = Directory.GetFi les(strBindPath ,"*???????????c art.xml") 'get[/color][/color]
            list[color=blue][color=green]
            > > of file and puts them in the array variable[/color]
            >
            > Directory.GetFi les is going to read it from the server though, not the
            > local drive. I believe the OP wants the client-side files to be read
            > and deleted. This *may* be possible with JavaScript, but I doubt it, to
            > be honest.
            >
            > --
            > Jon Skeet - <skeet@pobox.co m>
            > http://www.pobox.com/~skeet
            > If replying to the group, please do not mail me too[/color]

            Oops sorry about that. He could use <input type="file" .... to get the file
            and a <input type=submit ... to upload it, but deleting it would be a tough.


            Comment

            Working...