Tuesday, June 14, 2011

Delete files from file system older then 30 days

In order to have the files in a location (PATH) being deleted when they are older then 30 days, copy the line below to a text file and save it as a batch file.

forfiles /p "PATH" /s /d -30 /c "cmd /c del @file : date >= 30 days >NUL"

Then schedule a task to run daily at midnight.

Thursday, May 26, 2011

Signing an assembly in VS 2008


When creating code behind for web controls and other things, there is the need of signing the assembly that we will later deploy in the GAC.



In order to Create a Public/Private Key Pair with VS 2008, go to Tools > External Tools and create a new entry:



Command line is C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn.exe



and you will be prompt to change the argument when you go to Tools again and choose the jsut created "Create a new key pair". Just change the [FileName] with a proper name.


Many times there is also the need of getting the Public Key Token of an Assembly. To do this within Visual Studio 2008, repeat the steps with




Command line is C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sn.exe