Click to See Complete Forum and Search --> : remove, rename, delete file w/ javascript


kutu62
May 20th, 2008, 11:38 PM
how can i remove a file (or rename it or move it) with a javascript?

the file is located /root/Imacros/Macro/file.txt


now since I can't find any info on this with google I assume it can't be done

if it cant be done then can you make the script loop over and over looking for the file to change (last access time) - when the script notices the files last access time has changed the script will then jump to a particular line or execute xyz command. Once xyz command is executed the entire process will start over again.. of course it would be much easier if I could just remove the file or rename it..

many thanks

Thread1
May 21st, 2008, 02:34 AM
As far as I know, that is not allowed with javascript, for security reasons of course.

Alsvha
May 21st, 2008, 08:55 AM
Eekk - wouldn't want javascript to mess about with the files on my computer.
Takes just one script to wipe the windows directory :D

kutu62
May 21st, 2008, 09:26 AM
yes but this isn't a javascript that runs in html. It runs in a "add-on" to firefox. The add-on allows you to run javascript in it and turn your browser into an application..

Since I can't remove files can I look at when they were last modified and when that time stamp changes make xyz command execute and then loop it all over again? can anyone help me in this regard?

kutu62
May 21st, 2008, 10:45 AM
hey how about calling a unix shell script from within the javascript

IE

var x = 1;
while (x <= 12)
{
ret = iimPlay("inputtest");
CALL EXTERNAL JAVASCRIPT HERE
}

PeejAvery
May 28th, 2008, 10:20 AM
Nope. Sorry. JavaScript was never created to do any of these things. Nor should it ever be allowed for security purposes.