Created
November 12, 2013 10:43
-
-
Save kmlprtsng/7428955 to your computer and use it in GitHub Desktop.
Delete Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Would delete all the files in a directory. | |
protected void DeleteFiles() | |
{ | |
FileInfo[] files = new DirectoryInfo(Server.MapPath(WebConfig.ProfilePhotoPath)).GetFiles(WebConfig.ProfilePhotoPrefix + "*" + User.ID + ".*"); | |
foreach (FileInfo file in files) | |
{ | |
try | |
{ | |
file.Delete(); | |
} | |
catch (System.Exception ex) { } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment