[Gllug] Script for splitting dirs

Alistair Mann alistair at lgeezer.net
Tue Jun 3 15:31:53 UTC 2003


-----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

Cheers,
- -- 
Alistair
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+3L9pEz+/jt85AfsRAjlKAJ9dbEt+KkZmWYTFhb+n0H+WCj8HqwCdFKQS
GbkFstYb7FENyzljKUuy4qE=
=+phd
-----END PGP SIGNATURE-----



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




More information about the GLLUG mailing list