Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- Help(){
- echo "Hello!"
- echo "This script finds all the subfolders of the first level, which is not open any file."
- exit
- }
- Solution(){
- find "$dir" -mindepth 1 -maxdepth 1 -type d '!' -exec sh -c "lsof +d {} | grep -q ''" \; -print
- }
- dir=$1
- if [ -z $1 ]; then dir=$(pwd); fi
- if [[ $1 = "--help" || $1 = "-h" ]]; then Help; fi
- if [[ -d "$dir" ]]; then Solution; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement