Remove all files not listed by lsof in a folder

view story

http://stackoverflow.com – Recently I am writing a bash command-line script for maintaining the size of a specific folder. Note that some programs are at times writing/updating files inside this folder, so a "catch-all" rm -rf will never suit the case. I am able to retrieve all the "active", in other words, open files using lsof and print them out with awk: lsof +D ./ | awk ' { print ( $NF ) } ' This gives me a list of those open files, I obviously DON'T want to get rid of them. However I'd like to remove the rest. I wish there is an option in the rm command to exclude some files using the ^ option... Is there a w (HowTos)