0

I am trying to delete a folder named sim_build but I am not able because there are several .nfs* files in the sim_build (and also within the subfolders) that are busy/unclosed. I currently find the .nfs* files within directories manually using fuser --kill /path_to_nfs/.nfs*. after I delete all .nfs* files, I delete the folder using rm -rf sim_build.

As you can see this is way too cumbersome. What is the best way to automate it in a makefile?

any help appreciated!

M.X
  • 195
  • 3
  • 12
  • 1
    I am not sure I see where the problem is. Just create a phony target without dependencies and use your script as its recipe. But using make for this is a bit strange. A bash script would do the same. – Renaud Pacalet Dec 01 '21 at 15:12
  • the makefile isn't only for this task. I actually have a makefile, doing quite different tasks. What I will do is to extend the `clean` to remove the `.nfs*` files too. the reason to automate is that I don't know where the`.nfs*` files reside. every time I run the simulation, some folders are generated with different names and `.nfs*` files. – M.X Dec 01 '21 at 19:21
  • 1
    In any event there's no mystery here. Write the command lines that do what you want in your shell, then copy them into your makefile recipe, indent with TAB, and replace all `$` with `$$`. Done. if it doesn't work, post the rule you created, cut and paste the incorrect output, and describe what is wrong and what you wanted instead, then we can help. – MadScientist Dec 01 '21 at 19:55

0 Answers0