delete local files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
rscott said:
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.

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("FileName")
myDataColumn1.datatype=System.Type.GetType("System.String")
Dim myDataColumn2 As DataColumn= new datacolumn("LastWriteTime")
myDataColumn2.datatype=System.Type.GetType("System.DateTime")

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

strarr = Directory.GetFiles(strBindPath,"*???????????cart.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.getupperbound(0)
dim fi as new fileinfo(strArr(i))
dim drw as datarow
drw = dt.newrow()
drw("FileName") = strArr(i)
drw("LastWriteTime") = fi.lastwritetime
dt.rows.add(drw)
next i
 
vMike said:
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("FileName")
myDataColumn1.datatype=System.Type.GetType("System.String")
Dim myDataColumn2 As DataColumn= new datacolumn("LastWriteTime")
myDataColumn2.datatype=System.Type.GetType("System.DateTime")

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

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

Directory.GetFiles 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.
 
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
 
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
 
Jon Skeet said:
Directory.GetFiles 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.

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.
 
Back
Top