Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2E9AF11AE5 for ; Thu, 25 Sep 2014 06:57:43 +0000 (UTC) Received: (qmail 54356 invoked by uid 500); 25 Sep 2014 06:56:19 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 54253 invoked by uid 500); 25 Sep 2014 06:56:19 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 46443 invoked by uid 99); 25 Sep 2014 06:49:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Sep 2014 06:49:32 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [148.251.152.75] (HELO mail.5dlab.com) (148.251.152.75) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Sep 2014 06:49:06 +0000 Received: from jalves-mbp-2.fritz.box (HSI-KBW-37-209-24-4.hsi15.kabel-badenwuerttemberg.de [37.209.24.4]) by mail.5dlab.com (Postfix) with ESMTPSA id 1E9B2809E25B; Thu, 25 Sep 2014 08:48:44 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: FileUtil Copy example From: =?iso-8859-1?Q?Jo=E3o_Alves?= In-Reply-To: Date: Thu, 25 Sep 2014 08:48:43 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: user@hadoop.apache.org X-Mailer: Apple Mail (2.1878.6) X-Virus-Checked: Checked by ClamAV on apache.org Hey Susheel, Maybe it would be a good idea to check if the string is long enough for = your substring operation. (i.e. fstatus[i].getPath().getName().length() = >=3D 10) =20 On 25 Sep 2014, at 07:14, Susheel Kumar Gadalay = wrote: > I solved it like this. This will move a file from one location to > another location. >=20 > FileStatus[] fstatus =3D FileSystem.listStatus(new Path()); > for (int i=3D0; i if (fstatus[i].isFile()) { > if (fstatus[i].getPath().getName().substring(0, > 10).matches("")) > FileSystem.rename(new Path( + "/" + > fstatus[i].getPath().getName()), new Path( + "/" + > fstatus[i].getPath().getName())); > } > } >=20 > I don't think copy individual file API is available. >=20 >=20 > On 9/23/14, Susheel Kumar Gadalay wrote: >> Can somebody give a good example of using Hadoop FileUtil API to copy >> set of files from one directory to another directory. >>=20 >> I want to copy only a set of files not all files in the directory and >> also I want to use wild character like part_r_*. >>=20 >> Thanks >> Susheel Kumar >>=20