简体   繁体   中英

How to get access to directory/subdirectories/subdirectories?

I have a function that can observe files in directory and subdirectories, but it can't get access to files in the level 3 of subdirectories. I just need to observe some file changes and modify them so I need to touch all file in the directory recursively

Example: get access to home and home/directories , but can't touch home/sub (sub)directories. How to make that possible?

I want to see all files in the folder The code I have is:

 co(function* () {
  let close = yield awatch("./*", (event, filename) => {

    //Observing any single changement in file of ext ".html" in local directory 


    if (cropping_extension(filename) == ".html") {
      /**
       * Reading the contain of a file and keep it inside a string 
       */
      console.log(cropping_path(filename));

To have access to all the files in the folder you just need to change./* to =>./**/* So in your code you just need to change this part:

let close = yield awatch("./**/* ", (event, filename)

How are you hosting the directories? For example, if you're using Express (NodeJS) you'd want to elect a static directory to host all of your assets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM