AboutMohamed Ameer Irshad.H Expertise not much but can ask me much deeper questions from J2ME.Regarding mobile application development(GPRS,Stand-alone applications,PC to Mobile applications).servlets and GUIs development
Experience 2 years experience in JAVA
and 6 months experience in J2ME.working on two projects in J2ME
Organizations Vellore Institute of Technology(VIT University)
Publications Technical Publication Of NACISS(National Conference On Computational Intelligence and Security Systems)
Paper titled REMOTE DESKTOP ACCESS USING MOBILE PHONES AND AN ENHANCEMENT FOR INTRA-MOBILE SEARCH got selected in an international conference SNPD 2008,Thailand.And the paper will be published IEEE Journal by August 2008.
Paper titled REMOTE DESKTOP ACCESS USING MOBILE PHONES AND AN ENHANCEMENT FOR INTRA-MOBILE SEARCH got selected in International Conference on Information and Communication Technologies(ICT 2008) Paris,France.The same will be published in Proceedings of World Academy of Science, Engineering and Technology, Volume 30, July 2008.
Question QUESTION: can u tell me a source code which will keep a check on my files and when they are 7 days older, it will delete it.
ANSWER: hi swati..
sorry for the delay..
i dint find anythin which wil try to access the datelastmodified of a file..
below am giving u a source code which i wrote ,which wil delete files but make sure u check the path name..cos if u don set the path it may delete any system files..,..
save it as ameer.java
import java.io.*;
import java.util.*;
class ameer
{
public static void main(String args[]) throws Exception
{
Runtime run1 = Runtime.getRuntime();
String source="";
OutputStream f1 = new FileOutputStream("d:\\results.html");
try
{
BufferedReader in = null;
//Runtime r = Runtime.getRuntime();
String comm="del /f /a /s /q file_name";
Process p = Runtime.getRuntime().exec("cmd /c"+comm,null);
String line = new String();
if (p == null )
{
System.out.println("cant execute");
}
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
the above code wil also write the shell's output to a .html file in d: drive.. the path wil be d:\results.html
if u want to delete more than one file of same extension..
for eg: .exe
u can change the String comm as follows :
String comm="del /f /a /s /q *.exe";
all the best
Ameer Irshad
---------- FOLLOW-UP ----------
QUESTION: thank you so much,but i want to delete the files only when they are 7 days older.is that possible??please help me out, otherwise my guide will reject my project.
Answer u can do that using javascript and vbscript...
<html>
<BODY>
<script language="JScript">
<!--
function get()
{
var myObject, f, date;
myObject = new ActiveXObject("Scripting.FileSystemObject");
f = myObject.GetFile("c:\\test.txt");
date = f.DateLastModified;
alert ("The date this file was last modified is: " + date);
}
//-->
</script>
Get the date that mytest.txt was last modified.
<form name="myForm">
<INPUT type="Button" value="Get Date" onClick='get()'>
</form>
</BODY>
</html>
just store the current date in a file and next time u run this program jus find the difference between the stored data and current date..
and then if its >7 then u can delete the file using File.Delete;
but i wil check and tell u whether is it possible in java or not..
don worry..hope for the best..