List files in a directory, modify name.

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi,

I have made a code that list all files in a directory on the server.
It works fine, but I need to modify the filename (remove the 7 first char in
the name) that is displayed in the datagrid.

Example:
The file "123456_myfile.jpg" shoult be displayed like this: "myfile.jpg"

---------------------------
This is my code so far:
---------------------------

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim dirInfo As New
DirectoryInfo(Server.MapPath("/uploads/isaksenmedia/"))
Me.dtgFilelist.DataSource = dirInfo.GetFiles("*.*")
Me.dtgFilelist.DataBind()
End Sub


<asp:DataGrid id="dtgFilelist" runat="server" autogeneratecolumns="False">
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Name"
DataTextField="Name" HeaderText="Filename" />
<asp:BoundColumn DataField="LastWriteTime" HeaderText="Modyfied"
DataFormatString="{0:d}" />
<asp:BoundColumn DataField="Length" HeaderText="Size"
DataFormatString="{0:#,### bytes}" />
</Columns>
</asp:DataGrid>



Thanks!!!!!!


.



Relevant Pages

  • Re: fetch extension - use local filename from content-dispositionheader (new diff)
    ... Previously giving this non-argument -O flag would use the ... Now this flag takes an expected filename as an argument. ... if we make a mistake in the URL or if the server changes the mapping. ... +If the server sent a Content-Disposition header, the +.Fa content_disposition +field will contain the suggested local filename. ...
    (freebsd-current)
  • Re: Testing a file-type input element
    ... the filename selected is, or whether one was selected at all. ... may arise when the user inadvertently submits the form without selecting all ... I can test for an empty file form element name at the server side script, ... As far as client-side security goes: ...
    (comp.infosystems.www.authoring.html)
  • Re: Need help to reanimate an AT&T AT&T 3B1/7300 UNIX-PC
    ... mad at the user for creating filenames like that on a unix file server. ... pass a filename with '/' in it without attempting to interpret whatever ... at a lower level that the rest of the OS -- which since Microsoft's ... and let the install scripts work from there. ...
    (comp.sys.3b1)
  • RE: "Branding a SharePoint Portal Server 2003 Site"
    ... ich denke das du nicht wirklich alle benötigten seiten geändert hast. ... What files do I need to modify? ... represents a SharePoint Portal Server area template. ... Branding a SharePoint Portal Server 2003 Site: ...
    (microsoft.public.de.german.sharepointportalserver)
  • Re: Unable to verify copied file
    ... > file from a server for which the actual filename will vary when copied ... and there's only ever one of these files on the server share. ... it is my understanding that you can't verify ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)