.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

how to delete files from folder in webserver

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

hi i m using fileupload concept and saving the files to a folder download.hw can i check the files names saved in that folder while site is hosted on webserver.is there any way to delete some of files from that folder runtime. 

View Complete Post

More Related Resource Links

Copying files to a folder on web server



I have few files in FolderA on the web server.

I want the users to select a fews files from FolderA and copy them to FolderB on the same web server.

I want to list all the files in FolderA and allow the user to select a few files and copy.

I want to copy the files programatically when the user selects a few files and click on Copy button.

How to copy the files quickly from folderA to FolderB?




Programmatically delete a .webpart file from wpcatalogs folder from an IIS website


We are using a third party wsp in our solution which directly adds the web parts into the web application store rather than the web part gallery(References to them are present in IIS site's wpcatalog directory). We want to remove these web part files so that the users will not be able to add these web parts to pages directly. Or any other modification so that users will not be able to add these directly. Is there a way we can do this programmatically?

How to use Resource files added to Resources Folder ?



I have added .CSS file in Resources folder of the project.In the same way i can add Images or any other files.But i am unable to use those files in Server Control Project.How to apply CssClass property to any predefined server control to the css file that is stored in the Resources folder  ?

Please guide how to use those Resource files . 

Receive/Delete Multiple FTP Files based on condition using SCRIPT(VB) TASK

I am trying to receive and delete multiple FTP files from a remote FTP server using Script task Below is the code   Dim FTPConnMgr As ConnectionManager FTPConnMgr = Dts.Connections("FTP Connection Manager") Dim FTPClientConn As FtpClientConnection = New FtpClientConnection(FTPConnMgr.AcquireConnection(Nothing)) Dim FileTimeStampNew As String = "20100913021807" Dim remoteFileNames(0) As String remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "*" & FileTimeStampNew & ".*" 'Below hardcoded FileName works good. But the problem is there are lots of file in the FTP folder that I dont want to receive 'remoteFileNames(0) = Dts.Variables("FtpRemoteDirectory").Value & "Company_alpha_Full_20100913021807.xml" Dim localPath As String = Dts.Variables("FtpLocalDirectory").Value FTPClientConn.Connect() FTPClientConn.ReceiveFiles(remoteFileNames, localPath, False, False) FTPClientConn.Close() Dts.TaskResult = ScriptResults.Success End Sub End Class If i specifically mention the RemotefileNames this works fine but, when I say *.* it executes succefully but doesn't receives the file. Please advice how to receive multiple file based on a variable BR, AWM

Deploy folder for a .rdl files

In a win form app, i use a report viewer for local reporting, the troble is: I can't find a "Aplication relative folder" where to strore those .rdl files, so i can find them in a run time. Thks for any ideas. I'm using vb2010 express an sql 2008 expressDANIEL CABAÑAS LEÓN - I'M NOT AFRAID TO DIE, I'M NOT AFRAID TO LIVE

Delete bin and obj folder from projects directories

You always have problem to debug when you do latest from source control.You might end up deleting bin/obj folder sometime.Here is nice bat file which delete bin/obj folder(s). 1. copy this on notepad and save it as clean.bat file 2. Keep this file on root directory 3. Double check the directory on "DIR /B /AD /S obj" and "DIR /B /AD /S bin" ---------------------------------------------------------------------------------------------- FOR /F "tokens=*" %%G IN ('DIR /B /AD /S bin') DO RMDIR /S /Q ...(read more)

Copy files from one folder to another

hi  I am able to create a folder but is not able to copy files from the source to the newly created folder. Is there something that i missed out? Thanks  Dim sitename As String = "~/site/" & txtUsername.Text Directory.CreateDirectory(Server.MapPath(sitename))            Try                Dim f() As String = Directory.GetFiles("/site/source/")                For i As Integer = 0 To UBound(f)                    File.Copy(f(i), Server.MapPath(sitename) & "\" & (f(i)))                Next            Catch ex As ExceptionEnd Try  

How to run exe in different folder than dll files

Hello, How can I run de exe file in a different folder than the dll files? Now ill get the error: " Could not load file or assembly 'Pangaea.CMS.Module, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified" thx

Why are folder web.config files excluded?

I am asking this mainly out of curiosity. When access rules are created for folders using WSAT, web.config files are generated in these folders. I thought these rules should be deployed with the application (It is at least the case for all my applications), but these file are not included after creation so they are not deployed by default. What is the rationale behind this?

Querystring to determine what Document Library Folder's files to list?

First of all, any webpart that alllows you to list documents in a particular folder of a Document library? Second, possible to pass what folder to list via a query string to  that webpart ? Thanks.

Securing files using Handler and App_Data folder

HiI have secured some files on my webserver by putting them into the App_Data folder in the root (I do not have the option to secure folders using the ASAPI filter)The user gets access to these files by requesting them through a handler, fx. by requesting ~/Handler.ashx?file=App_Data/MySubFolder/MyFile.jpgNow, I want to make all the content in a specific folder called "Members" (a single subdirectory of the App_Data folder) available only by passing a specific password. That is by requesting ~/Handler.ashx?file=App_Data/MySubFolder/MyFile.jpg&password=xxxxIn my Handler.ashx I have written some logic seeking if InStr(context.Request.QueryString("file"), "Members") = 0 before sending the file. If inStr <> 0 a password is required.Is this a good way to secure a folder in and its content? Is there a way of getting access anyway, like using some kind of "sub-directory" line in the path (the same way as you can request parent directory by using "../../Myfile.jpg)? I know there will be a problem if someone fx. legitimately tries to access the file App_Data/Members.jpgThanks in advance!-Jesper

Users can delete the parent folder even when they don't have delete permission on subfolders

I'm trying to use a document library to manage project documents. I created a folder for each project, and under the project folder, there are two subfolders with special permissions for confidential documents. I give normal users the Contribute permission of the project folders so they can add/remove new subfolders under the projecct folder. However, with this configuration the normal users can delete the whole project folder in the web interface, even they don't have delete permission for the two subfolders. Is there a way to prevent this? Regards, James Liang

Delete Old Backup Files that are saved in .RAR format



I have configured my SQL Server 2005 to take backups and I have another program running to compress these files to .RAR extension to save space.

I have a Maintenance Cleanup Task also configured to delete old .RAR files but it does not work.  I have specified the extension to look for to be RAR and the job runs without error but no files are deleted.

Is it that only BAK and TRN files are deleted using Maintenance Cleanup Task?

Copy folder from FTP site using SSH to local machine using DOS batch files



Is there a way to copy a folder from an FTP site listening on SSH connection using DOS batch files? I know that there are several third party tools out there that accomplish this. I am NOT looking for that solution. I tried this in Powershell, but could not find a solution, and I am hoping a simple DOS batch file can handle this.


Any help would be appreciated...

Dave SQL Developer

copy a folder and subfolders + files from remote location to local drive



i am making a windows application( C#.Net) in which there is a folder placed at remote location( on other computer). this folder contains files + subfolders inside it. i need to copy all the files and subfolders present inside this main folder to my local drive. How can i do this. 

Thanks in advance

Delete files older than 3 days using SSIS tasks


I want to delete all files in a given folder that are older than 3 days from today's date.

I tried using a "Foreach Loop container"  with a "File System" task inside it but found I couldn't access any file properties such as the file creation date. Am I using the wrong task for this job?






P.S. History of the problem:

I used the sql 2005 Database maintenance program to setup our database backup jobs. One day I noticed that the free space on the drive where we keep the dumps had grown small. I found that we had at least 4 weeks of dumps in there, not the 3 days I wanted to keep!  I looked but could not find the "delete file" option in the SSIS package generated by the Database Maintenance Wizard. No wonder the files were piling up.

Delete images from folder physically in vb.net


I am using grid view and on grid delete image click i remove product but i also want to remove image phisically from the folder.

i have deleted logically but i need code to delete from folder ?





Hafiz Awais


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend