Javascript question

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
I know nothing about Javascript's capabilities. Is it possible to create a simple webpage that can delete or rename a file when a user clicks on a button?
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
An example/more info if it's helpful:

A user has a file with a known name, say "stooges.txt". This file is sitting in a precisely known location, say "C:\Info\". Say I want to change the filename to "3_stooges.txt"

In this example, I'd like (and this may not be possible) to generate an HTML page that would include a button to rename C:\Info\stooges.txt to C:\Info\3_stooges.txt

Generating an HTML document is not the problem - I can do that and embed the desired file names and location. My question is, is there even some kind of HTML document I can build in the first place that will allow a file to be renamed by having a user click on a button under these circumstances?

Maybe I could do this in Java. But then, in this situation Internet Explorer is what I'm forced to deal with, and I'm not sure that means "real" Java is an option.
 

Fushigi

Storage Is My Life
Joined
Jan 23, 2002
Messages
2,890
Location
Illinois, USA
I truly hope that you cannot do this via a browser. Think of the repercussions if clicking a link could rename a file.
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
Yes, that's exactly what I thought at first Fushigi. But then I remembered that this is a Windows + IE environment, and figured it might therefore even be possible for Javascript to obtain your social security number and a DNA sample. Renaming a file seemed like a minimal possibility.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,741
Location
USA
Are you absolutly stuck using javascript? If you want to do this server-side, I know php has the ability to rename files with the rename() function. I could even write it for you if you want.
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
Handruin said:
Are you absolutly stuck using javascript? If you want to do this server-side, I know php has the ability to rename files with the rename() function. I could even write it for you if you want.

Thanks for the offer Handruin (I would have taken you up on it), but doing something server-side isn't an option, because there is no server in this case. It'd just be a single HTML/Javascript/JScript/VBScript/Whateverscript document hanging out with a bunch of files that (may) need renaming.

This is something I could solve easily with a C++ or VB program, but installing software requires going through a few hoops (fascist admins).

Heck, even a batch file could do it, except I need a human to see ... umm ... things ... before they decide whether to click on the "rename the file" button.

Will: I took a quick look at the FileSystemObject in JScript, and that seems promising.

I'll give something a try and let you know if I have any success. Thanks all.
 

ddrueding

Fixture
Joined
Feb 4, 2002
Messages
19,528
Location
Horsens, Denmark
So just to be clear, the file to be renamed and the HTML (or whatever) are sitting in the same directory and will be executed locally?
 

i

Wannabe Storage Freak
Joined
Feb 10, 2002
Messages
1,080
ddrueding said:
So just to be clear, the file to be renamed and the HTML (or whatever) are sitting in the same directory and will be executed locally?

Yes.

(I love short answers :) )
 
Top