|
From: | Major Péter |
Subject: | Re: Did I found a bug in "ls"? |
Date: | Tue, 10 Mar 2009 13:00:34 +0100 |
User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
Sorry about the off-topic. But here is some list-related problems of mine: ls: If it has a null parameter e.g. in "find blah -print0 | xargs -0 ls" find gives no hit,the ls writes on the output (maybe on error output, I'm not sure) a message, that incorrect argumentum has camed, BUT it still writes out the content of a normal ls, and the exit status is 0. So that's why I need to check first, that the find output whether null is or not...
And I have some problem with du too. Which is: it can't write out the size of a single folder. There is no option to do that, it adds the content of the folder too always.
//The script for homework has been written now, thanks for helping me out, the xargs command was really helpful.
//If someone interested in it: http://sclub3.uw.hu/homework/irfhw.sh Regards, Peter Philip Rowlands írta:
On Sun, 8 Mar 2009, Major Peter wrote:The main problem with du is, that it doesn't care with users, so I need a "find" before (using the -user will solve the problem). But I can't use du `find ...` because it will contain the subfolders too, so it will duplicate, and the measure won't be correct. (Or if I'm use the --max-depth option it will still not care with the user filtering).So by now I have this: du `find . -type f -user foobar` using sed, and a for cycle I can make a sum from this values.But now, I don't have the sizes of the directories, so that's why I tried to use: ls `find . -type d -user foo -name "*"` # -name "*" will be removed in the final versionbut didn't worked, so I wrote here a mail.If you know a better way, please just send me a command or parameter name, because this is my homework. :)I don't expect this list will do your homework for you, however... you can get all the required information about users and filesizes from find's -printf action.Cheers, Phil
[Prev in Thread] | Current Thread | [Next in Thread] |