Check If the Directory Folder
Is Empty
Want to know if exist a function that controls if a folder in unix system is empty or not. What means "control"? - perhaps " a way to test if a directory is empty"? Yes, I have to check if the directory is empty.
I'm assuming you want a script function. This works with ksh: listfiles() { ls -1 ${1:+"$@"} 2>/dev/null; } is_dir_empty()
# here's how if can be used: execute the chmod command only if there's something in the directory: dirobj="/tmp/mydir"
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|