<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=1063991&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / ls taille et nom de fichier]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1063991</link>
		<description><![CDATA[Les sujets les plus récents dans ls taille et nom de fichier.]]></description>
		<lastBuildDate>Thu, 11 Oct 2012 16:20:36 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11087221#p11087221</link>
			<description><![CDATA[<p>Salut,</p><div class="quotebox"><cite>Maisondouf a écrit&#160;:</cite><blockquote><div><div class="codebox"><pre><code>for i in `ls -1`; do echo &quot;$i  `ls -l $i | awk &#039;{print $5}&#039;`&quot;;done</code></pre></div></div></blockquote></div><p>Pour boucler sur des fichiers, on ne le fait pas sur la sortie de ls, ça provoque des erreurs des qu&#039;il y a des espaces.<br />Plutôt que :</p><div class="codebox"><pre><code>for i in `ls -1`
do...</code></pre></div><p>On fait :</p><div class="codebox"><pre><code>for i in *
do
&lt;commande&gt; &quot;$i&quot;
done</code></pre></div><p>Sinon, merci à tous pour vos exemples avec perl ou python.</p><p>@nesthib<br />Je ne sais pas si ça vaut le coup d&#039;ouvrir une discussion. J&#039;ai posté ici vu que ça parlait des dates et je me disais que si quelqu&#039;un avait LA commande magique pour ce problème, ça aurait été intéressant.<br />Enfin, c&#039;est toi qui voit !<br />Merci encore et désolé pour ce petit HS !</p><p>Édit :<br />Ah, en fait ça parlait de la taille et non des dates... Donc j&#039;étais bien HS, je viens de m&#039;en rendre compte... C&#039;est parce que j&#039;ai le cerveau qui déraille quand on me fait commencer le taf à 6h du mat&#039; !</p>]]></description>
			<author><![CDATA[dummy@example.com (Postmortem)]]></author>
			<pubDate>Thu, 11 Oct 2012 16:20:36 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11087221#p11087221</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11086271#p11086271</link>
			<description><![CDATA[<p>@nesthib: qu&#039;est ce que tu veux que je te dise, tout ce que je connais de &#039;awk&#039; c&#039;est &#039;print&#039;....</p><p>Je savais même pas que &#039;index&#039; et &#039;substr&#039; existaient, je vais réviser... <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Maisondouf)]]></author>
			<pubDate>Thu, 11 Oct 2012 15:16:50 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11086271#p11086271</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11082871#p11082871</link>
			<description><![CDATA[<p>hello<br />on peut utiliser perl sur les sytèmes qui n&#039;ont pas stat</p><div class="codebox"><pre><code>$ ls -ln co1.txt
-rwxr-xr-x 1 1000 1000 2730366 2012-04-04 12:26 co1.txt
$ stat -c %s co1.txt
2730366
$  perl -e &#039; printf &quot;%ld\n&quot; ,(stat($ARGV[0]))[7]&#039; co1.txt
2730366
$ </code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (credenhill)]]></author>
			<pubDate>Thu, 11 Oct 2012 10:11:43 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11082871#p11082871</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11081561#p11081561</link>
			<description><![CDATA[<p>Merci à tous !</p>]]></description>
			<author><![CDATA[dummy@example.com (jejeman)]]></author>
			<pubDate>Thu, 11 Oct 2012 08:16:32 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11081561#p11081561</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11080611#p11080611</link>
			<description><![CDATA[<p>Attention, avec le module os en python, il y a beaucoup de fonctions os-dépendantes, d&#039;ailleurs la <a href="http://docs.python.org/py3k/library/os.html#os.stat">documentation python</a> met en garde sur les différences qui peuvent exister. Il juste juste penser à vérifier ces variabilités de comportement <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>(du coup on déplace cette discussion pour éviter le HS ?)</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Thu, 11 Oct 2012 05:24:20 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11080611#p11080611</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11080511#p11080511</link>
			<description><![CDATA[<p>Bonjour,<br />Il y a <strong>python</strong> :</p><div class="codebox"><pre><code>os.stat(&#039;/chemin…/fichier&#039;).st_atime
os.stat(&#039;/chemin…/fichier&#039;).st_mtime
os.stat(&#039;/chemin…/fichier&#039;).st_ctime</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Thu, 11 Oct 2012 04:54:53 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11080511#p11080511</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11080361#p11080361</link>
			<description><![CDATA[<p>Dès lors que tu bascules vers d&#039;autres unix tu perds vite en &quot;universalité&quot;, d&#039;autant plus qu&#039;au delà de la commande stat tu as des différences dans la gestion elle-même des temps (atime, mtime, ctime). Si la question t&#039;intéresse je pense que l&#039;on peut en débattre dans un autre fil (je peux déplacer ton message dans une nouvelle discussion si tu le souhaites).</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Thu, 11 Oct 2012 03:34:01 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11080361#p11080361</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11078971#p11078971</link>
			<description><![CDATA[<p>Salut,<br />Je me permet une petite question concernant la récupération de la date : est ce que vous connaissez un moyen &quot;universel&quot; ?<br />Perso, sous Linux, j&#039;aurais fait comme pingouinux, avec stat.<br />Par contre, bcp d&#039;unix n&#039;ont pas la commande stat et du coup, ben je fais un peu comme nesthib... Sauf que avec cette méthode, faut faire un awk un peu tarabiscoté... En effet, la date peut avoir des formes diverses et variées selon l&#039;unix utilisé et selon l&#039;ancienneté du fichier : si le fichier est ancien, on a la date avec l&#039;année mais pas forcément l&#039;heure, si le fichier est plus récent, on a la date avec l&#039;heure mais pas l&#039;année etc etc...<br />Merci d&#039;avance !</p>]]></description>
			<author><![CDATA[dummy@example.com (Postmortem)]]></author>
			<pubDate>Wed, 10 Oct 2012 20:47:33 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11078971#p11078971</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076171#p11076171</link>
			<description><![CDATA[<div class="codebox"><pre><code>ls -l | awk &#039;/^-/{for (i=9;i&lt;=NF;++i){nom=nom&quot; &quot;$i}; print $5 nom}&#039;</code></pre></div><p>voilà avec une boucle qui n&#039;aura pas ce soucis</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Wed, 10 Oct 2012 17:02:57 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076171#p11076171</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076161#p11076161</link>
			<description><![CDATA[<p>J&#039;ai corrigé.</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Wed, 10 Oct 2012 17:01:18 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076161#p11076161</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076121#p11076121</link>
			<description><![CDATA[<p>tu veux dire « ne soit PAS » ? <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p><p>Sinon effectivement, c&#039;est un petit hack awk mais qui peut facilement être remplacé par une petite boucle for du 9è au dernier champ. <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Wed, 10 Oct 2012 16:57:42 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076121#p11076121</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076091#p11076091</link>
			<description><![CDATA[<p>@nesthib #6 :<br />Avec ta commande, il ne faut pas que le nom du fichier soit identique au nom d&#039;utilisateur ou de groupe (entre autres).<br /><span class="bbu">Édité</span> : Petite correction</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Wed, 10 Oct 2012 16:55:15 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11076091#p11076091</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11075911#p11075911</link>
			<description><![CDATA[<p>@Maisondouf : ta ligne de commande comprend beaucoup de parties inutiles et redondantes, en plus tu vas générer des erreurs sur les fichiers avec des espaces dans le nom.</p><p>Une façon propre d&#039;afficher la taille puis le nom de fichier :</p><div class="codebox"><pre><code>ls -l | awk &#039;/^-/{print $5, substr($0, index($0,$9))}&#039;</code></pre></div><p>(le /^-/ filtre pour ne garder que les fichiers)</p><p>Pour avoir le chemin complet je pense que tu as besoin de passer par find.</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Wed, 10 Oct 2012 16:41:38 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11075911#p11075911</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11075681#p11075681</link>
			<description><![CDATA[<p>Salut,</p><div class="codebox"><pre><code>while read fic;do stat -c &quot;%n %s&quot; &quot;$fic&quot;;done &lt; &lt;(find $PWD -type f)</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Wed, 10 Oct 2012 16:29:50 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11075681#p11075681</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  ls taille et nom de fichier]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11075191#p11075191</link>
			<description><![CDATA[<p>@cep: celui la je l&#039;avais mais il affiche la taille du fichier en block et moi je voulais la taille exacte<br />@Maisondouf: merci c&#039;est ça qu&#039;il faut... Mais est-ce qu&#039;on peut avoir le chemin complet du fichier + le fichier plutôt que uniquement le nom du fichier</p><p>Merci.</p>]]></description>
			<author><![CDATA[dummy@example.com (jejeman)]]></author>
			<pubDate>Wed, 10 Oct 2012 15:35:05 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11075191#p11075191</guid>
		</item>
	</channel>
</rss>
