1

I am planning to create an app using html5 file api and javascript to take directory path as input and be able to process (search for a text) all files in that directory and sub directories.

currently I am doing it using batchscript, What are constraints/obstacles doing it using HTML/javascript.

Kailash Singh
  • 405
  • 2
  • 7
  • 12

1 Answers1

3

In short: You can't to that automatically.

Access the local filesystem from any browser is blocked for security reasons. Reason: Imagine any website being able to access the files on your filesystem.

Read this: Local file access with javascript

Maybe you want to rephrase your question and say what you actually want to acheive.

You can access simple file information using the user's input and using <input type=file>. But the user would require to do the following steps:

  1. Click the "Browse button" (a file dialogue appears).
  2. Navigate to the requested folder.
  3. Select 1 or many files.
  4. Click "Open".

Mozilla has documented this well with an example: https://developer.mozilla.org/en/docs/Using_files_from_web_applications#Example_Showing_file(s)_size

Community
  • 1
  • 1
psiphi75
  • 1,985
  • 1
  • 24
  • 36