From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 677117ED34 for ; Tue, 3 Jul 2012 10:46:12 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of fabrissimo@gmail.com) identity=pra; client-ip=209.85.214.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of fabrissimo@gmail.com designates 209.85.214.182 as permitted sender) identity=mailfrom; client-ip=209.85.214.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ob0-f182.google.com) identity=helo; client-ip=209.85.214.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="postmaster@mail-ob0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiQCAAyw8k/RVda2kGdsb2JhbABFhVqgEpB0CCIBAQEBCQkNBxQEI4IYAQEBBBICDwQZAS0LAQMMAQUFCw0CAgkdAgIhARIBBQEKEgYTEgkHh1sDCwucNAkDi1SDQIVxJwMKiUgBBQyBFIkyZoUIgRIDlTWBEolxgyM+gVSCLA X-IronPort-AV: E=Sophos;i="4.77,514,1336341600"; d="scan'208";a="165382506" Received: from mail-ob0-f182.google.com ([209.85.214.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 03 Jul 2012 10:46:11 +0200 Received: by obbun3 with SMTP id un3so17129844obb.27 for ; Tue, 03 Jul 2012 01:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=z8MX/AijaylZsQWhF9z818vprXVvZNUQPwcmNbvENEs=; b=Jnxx2j9dDkF+KBE1bp9znpgsRxptSMjjiR6NWfxEiA4eyT1ysZDX2D+7TJuCAML/TO wsJ46WWj04bRCTabPhBRDKSc9lKZ5xvEd1vfGccs/C0eCnaplIYsizo76FfkX6XnvFea BWX56W70aa2qqUyDB3d6zZkpRJYRUQ/Oq1+JdOT8MDPYGWVrrJB2p0dgxh+MhGGBktYN KQHo45Fy3QVw9R7hhZn0N0890Okd6NhA5mYuFwx6EjYSUXaoLW5gh2o/mxIvhk8zhsbC xJ//ShL0wkNC4UTb9SdNYWF9Xt9m0pmrj1j4U+Ljj9T10N0giy80ecJAhnANqHZUJrwW aH3g== MIME-Version: 1.0 Received: by 10.182.216.99 with SMTP id op3mr11797837obc.30.1341305170308; Tue, 03 Jul 2012 01:46:10 -0700 (PDT) Sender: fabrissimo@gmail.com Received: by 10.76.3.146 with HTTP; Tue, 3 Jul 2012 01:46:10 -0700 (PDT) In-Reply-To: References: <271211341286221@web29f.yandex.ru> <4FF28EEA.7060009@glondu.net> <481061341303698@web18d.yandex.ru> Date: Tue, 3 Jul 2012 10:46:10 +0200 X-Google-Sender-Auth: SUcJtN39XvEmSIzqW6bYkctOfCc Message-ID: From: Fabrice Le Fessant To: Gabriel Scherer Cc: Ivan , =?ISO-8859-1?Q?St=E9phane_Glondu?= , "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] howto: recursively iterate over filesystem let rec iter_dir f dirname =3D let files =3D Sys.readdir dirname in Array.iter (fun file -> let file =3D Filename.concat dirname file in (f file : unit); if Sys.is_directory file then iter_dir f file ) files ? On Tue, Jul 3, 2012 at 10:24 AM, Gabriel Scherer wrote: > Have you tried the dead simple solution first, with Sys.readdir and > Sys.is_directory from the standard library ( > http://caml.inria.fr/pub/docs/manual-ocaml/libref/Sys.html ), to see > if it suits your need? You can always switch to richer but more > complex alternatives if you have more specific needs later. > > On Tue, Jul 3, 2012 at 10:21 AM, Ivan wrote: >> Mer=D1=81i, it looks nice! But I didn't understand what's the issue with= links. The FilePath.mli file contains a >> warning, that I've failed to understand: >> 32 This module manipulate abstract path that are not bound to a re= al filesystem. >> 33 In particular, it makes the assumption that there is no symboli= c link that >> 34 should modify the meaning of a path. If you intend to use this = module >> 35 against a real set of filename, the best solution is to apply t= o every >> 36 filename to solve symbolic link through {!FileUtil.readlink}. >> >> In my situation a folder, which I'd like to traverse, is plenty of links. >> Maybe someone can clarify it for me? >> >> 03.07.2012, 10:19, "St=C3=A9phane Glondu" : >>> Le 03/07/2012 05:30, Ivan a =C3=A9crit : >>> >>>> Are there any libraries that allow to walk through a filesystem (linux >>>> filesystem in particular). At best I would like to find some library >>>> that provides an ``iter'' function that will recursively iterate over >>>> files and subdir in the given folder. At the very best, a library >>>> resembling (by functionality) boost.filesystem will be very nice. >>> >>> http://forge.ocamlcore.org/projects/ocaml-fileutils/ >>> >>> Cheers, >>> >>> -- >>> St=C3=A9phane >>> >>> -- >>> Caml-list mailing list. Subscription management and archives: >>> https://sympa-roc.inria.fr/wws/info/caml-list >>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >>> Bug reports: http://caml.inria.fr/bin/caml-bugs >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa-roc.inria.fr/wws/info/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --=20 Fabrice LE FESSANT