[Gllug] Script for splitting dirs

Robert McKay robert at mckay.com
Tue Jun 3 16:55:57 UTC 2003


On Tue, 3 Jun 2003, Alistair Mann wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thus spaketh Andy Farnsworth on Tuesday 03 June 2003 3:04 pm:
> > > "Daniel Andersson" writes:
> > > >> Not really. The only issue is getting the filesize, which is either
> > > >> done by parsing the output of ls, or calling a helper application.
> > > >
> > > >haven't really followed this
> > > >but what about using "filesize", no need to parse output of ls
> > >
> > > That would count as a helper application. Plus:
> > >
> > > 	isengard:~% filesize
> > > 	bash: filesize: command not found
> > >
> > > I'm guessing it's a Debian thing. It makes your script non-portable
> > > even to different Linux distributions, let alone to other Unices.
> >
> > I doesn't seem to be a Debian thing either.  I run Debian and it is not
> > available via apt-get / dselect at all.
> >
> > However, here i a perl oneliner that returns the filesize of the filename
> > passed to it.
> >
> > #!/usr/bin/perl -l
> > print ((stat $ARGV[0])[7]);
>
> If more convenient, you can make it a ... uh ... halfliner?:
>
> [al at svetlana al]$ perl -e 'print((stat $ARGV[0])[7])' ./testfile
> 73

Might I suggest wc -c ?

-Robert.



-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list