6 Replies - 20005 Views - Last Post: 09 November 2010 - 05:56 PM

#1 Guest_Christopher*


Reputation:

Copy file from one directory to another directory

Posted 09 November 2010 - 03:30 AM

Hi There,

I'm working on a project for work and I'm having some issue trying to distribute to program the smoothes as possible, on idea I had was using Javascript, Iím kind of new at this so ill explain to you what Iím hoping to do. Basically Iím looking for a onload=ĒĒ function when the .hta openís it would get a file from lets say G:\path\path1\path2\file.hta to C:\path\path1\folder So it would take the file and copy past it in another folder from a different directory. I look everywhere for a code that could help me. If a popup message could popup saying completed as well that would be great.

Is This A Good Question/Topic? 0

Replies To: Copy file from one directory to another directory

#2 MrLuke187  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 81
  • View blog
  • Posts: 237
  • Joined: 09-July 10

Re: Copy file from one directory to another directory

Posted 09 November 2010 - 05:13 AM

Javascript can't access local files on the computer, because it's running in a kind of sandbox.

Greetings: MrLuke
Was This Post Helpful? 1
  • +
  • -

#3 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2833
  • View blog
  • Posts: 12,001
  • Joined: 20-September 08

Re: Copy file from one directory to another directory

Posted 09 November 2010 - 05:36 AM

You could use a signed applet or Web Start application to do that
Was This Post Helpful? 0
  • +
  • -

#4 koffer08  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 09-November 10

Re: Copy file from one directory to another directory

Posted 09 November 2010 - 01:48 PM

View Postg00se, on 09 November 2010 - 04:36 AM, said:

You could use a signed applet or Web Start application to do that



thanks for the heads up, how would i use that?? I'm on a server computer so i can't download anything it has to be done with what i have.
Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5943
  • View blog
  • Posts: 12,871
  • Joined: 16-October 07

Re: Copy file from one directory to another directory

Posted 09 November 2010 - 04:30 PM

View Postg00se, on 09 November 2010 - 06:36 AM, said:

You could use a signed applet or Web Start application to do that


With Javascript? I don't think so.

An .hta file does have some odd rights on a windows system. Rather than "javascript" search on "jscript" and "filesystemobject".

You can use:
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFile ("c:\\mydocuments\\letters\\*.doc", "c:\\tempfolder\\");



More here.
Was This Post Helpful? 0
  • +
  • -

#6 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2833
  • View blog
  • Posts: 12,001
  • Joined: 20-September 08

Re: Copy file from one directory to another directory

Posted 09 November 2010 - 04:36 PM

I wasn't suggesting Javascript. Yes, you could use the FileSystemObject, but signing a Javascript (it would need to be signed) is a hell of a lot harder than signing an applet/Web Start app

I'm not sure of what to make of

Quote

I'm on a server computer so i can't download anything it has to be done with what i have.

Was This Post Helpful? 0
  • +
  • -

#7 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5943
  • View blog
  • Posts: 12,871
  • Joined: 16-October 07

Re: Copy file from one directory to another directory

Posted 09 November 2010 - 05:56 PM

Yeah, I wasn't sure what to make of that, either. I'd also thought HTAs were mostly depreciated. However, if you're willing to use them, signing shouldn't be required. It's as trusted as it gets.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1