I
I
iandriyanov2012-06-19 12:55:59
linux
iandriyanov, 2012-06-19 12:55:59

Checking a directory for content, how?

Good afternoon.

I'm sitting dumb, I tried a bunch of combinations.

There is a folder, files are periodically added to this folder along the crown.

How to check this folder and pull out files of 0 (zero size)?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
I
Iliapan, 2012-06-19
@Iliapan

Sorry but facepalm.jeepeg
find. -size 0c

M
Mithgol, 2012-06-19
@Mithgol

Variant on  Node.js :

var fs = require('fs');
var filenames = fs.readdirSync('.');
var i, stats;
for (i = 0; i < filenames.length; i++) {
   stats = fs.statSync(filenames[i]);
   if (stats.isFile() && stats.size === 0) console.log(filenames[i]);
}

G
gvsmirnov, 2012-06-19
@gvsmirnov

foldrya

1337,Br0! j00Z r $0 4\/\/3$0/\/\3!

S
Sergey Lerg, 2012-06-19
@Lerg

awk option:
ls -o | awk '$4 == 0 {print($8)}'

J
J_o_k_e_R, 2012-06-19
@J_o_k_e_R

find -size 0

S
script88, 2012-06-19
@script88

Files by size set to 0 and filtered by name

find dir/ -name [имя файла] -size 0

Or will output all files with size equal to 0
find dir/ -size 0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question