stat -c %s /path/to/fileor
#!/bin/bash path=/path/to/file size=$(stat -c %s ${path}) if [[ $size -eq 0 ]]; then echo "${path} is a zero-size file." fiNote: If path directs to a directory, it will not fail nor return 0. It returns the block size associated with the directory. See this for more details.
No comments:
Post a Comment