Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

getting file names in a directory using java script lang.

ilker_konarilker_konar Posts: 3Member
Hi;
I am trying to traverse in a directory in a local machine, and get names of all the files there. Could you please help me?
I am waiting to hearing from you.

Comments

  • WaltPWaltP Posts: 335Member
    : Hi;
    : I am trying to traverse in a directory in a local machine, and get names of all the files there. Could you please help me?
    : I am waiting to hearing from you.
    :
    JS can't do it. It's been designed to interact as far as the browser only for security reasons. If it could, how would you like someone to write a script that reads your entire drive and sent it back to the owner of the web page?


    ----------------
    Walt


  • ilker_konarilker_konar Posts: 3Member
    Hi WaltP;
    In fact, the job that I am trying to do: There a lot of files in a directory in name plus date format like "volumes1302030947". 13 is the day, 02 is the month, 03 is the yaer, 09 is the hour and 47 is the minutes. I have designed a html page. The user enters the date criterias(only day, month and year), and the files appropriate to them will be listed. And the user than, will select one of them. And the file will be opened. Here, I anyway authorize the user, because the machine is mine. And perhaps I may not publish the pages in the internet, and I can use them myself. Can I not access my machine?
    I hope I could understand. Do you have any idea?
  • WaltPWaltP Posts: 335Member
    [b][red]This message was edited by WaltP at 2003-8-14 21:12:26[/red][/b][hr]
    : Hi WaltP;
    : In fact, the job that I am trying to do: There a lot of files in a directory in name plus date format like "volumes1302030947". 13 is the day, 02 is the month, 03 is the yaer, 09 is the hour and 47 is the minutes. I have designed a html page. The user enters the date criterias(only day, month and year), and the files appropriate to them will be listed. And the user than, will select one of them. And the file will be opened. Here, I anyway authorize the user, because the machine is mine. And perhaps I may not publish the pages in the internet, and I can use them myself. Can I not access my machine?
    : I hope I could understand. Do you have any idea?

    I feel your pain. As I said, for security, JavaScript cannot read the disk. The only possibility I can think of would be to create a file that you can include in your JS, maybe assigning each filename to an array, but this file will have to be recreated as new files are added.

    The other option is to use PHP, ASP, or Perl.


    ----------------
    Walt




  • ilker_konarilker_konar Posts: 3Member
    Thank you, Walt.
    I have accomplished it using VBScript. See you...
Sign In or Register to comment.