You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by nisha sharma <ni...@gmail.com> on 2012/09/05 13:14:56 UTC

directory delete in hadoop

 Hi,

I m usin the below method to delete a directory named testingfolder, will
this method delete all my jpeg files inside this directory will these files
also get deleted from hdfs along with the directory

fileSystem.delete(*new* Path("/user/testingfolder"),*true*);

Re: directory delete in hadoop

Posted by Chen He <ai...@gmail.com>.
you have to include the hdfs-site.xml and hdfs-default.xml. Because those
two files tell you where is the namenode and what is the operation port.

On Wed, Sep 5, 2012 at 6:47 AM, Harsh J <ha...@cloudera.com> wrote:

> Yes, if you delete a directory, its contents are recursively deleted.
> If you do not want that to happen (i.e. you want a protective
> measure), use
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
> with false. And it will never delete a directory.
>
> Sort of like rm vs. rm -r on *nix.
>
> On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com>
> wrote:
> > Hi,
> >
> > I m usin the below method to delete a directory named testingfolder, will
> > this method delete all my jpeg files inside this directory will these
> files
> > also get deleted from hdfs along with the directory
> >
> > fileSystem.delete(
> > new Path("/user/testingfolder"),true);
>
>
>
> --
> Harsh J
>

Re: directory delete in hadoop

Posted by Chen He <ai...@gmail.com>.
you have to include the hdfs-site.xml and hdfs-default.xml. Because those
two files tell you where is the namenode and what is the operation port.

On Wed, Sep 5, 2012 at 6:47 AM, Harsh J <ha...@cloudera.com> wrote:

> Yes, if you delete a directory, its contents are recursively deleted.
> If you do not want that to happen (i.e. you want a protective
> measure), use
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
> with false. And it will never delete a directory.
>
> Sort of like rm vs. rm -r on *nix.
>
> On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com>
> wrote:
> > Hi,
> >
> > I m usin the below method to delete a directory named testingfolder, will
> > this method delete all my jpeg files inside this directory will these
> files
> > also get deleted from hdfs along with the directory
> >
> > fileSystem.delete(
> > new Path("/user/testingfolder"),true);
>
>
>
> --
> Harsh J
>

Re: directory delete in hadoop

Posted by Chen He <ai...@gmail.com>.
you have to include the hdfs-site.xml and hdfs-default.xml. Because those
two files tell you where is the namenode and what is the operation port.

On Wed, Sep 5, 2012 at 6:47 AM, Harsh J <ha...@cloudera.com> wrote:

> Yes, if you delete a directory, its contents are recursively deleted.
> If you do not want that to happen (i.e. you want a protective
> measure), use
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
> with false. And it will never delete a directory.
>
> Sort of like rm vs. rm -r on *nix.
>
> On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com>
> wrote:
> > Hi,
> >
> > I m usin the below method to delete a directory named testingfolder, will
> > this method delete all my jpeg files inside this directory will these
> files
> > also get deleted from hdfs along with the directory
> >
> > fileSystem.delete(
> > new Path("/user/testingfolder"),true);
>
>
>
> --
> Harsh J
>

Re: directory delete in hadoop

Posted by Chen He <ai...@gmail.com>.
you have to include the hdfs-site.xml and hdfs-default.xml. Because those
two files tell you where is the namenode and what is the operation port.

On Wed, Sep 5, 2012 at 6:47 AM, Harsh J <ha...@cloudera.com> wrote:

> Yes, if you delete a directory, its contents are recursively deleted.
> If you do not want that to happen (i.e. you want a protective
> measure), use
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
> with false. And it will never delete a directory.
>
> Sort of like rm vs. rm -r on *nix.
>
> On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com>
> wrote:
> > Hi,
> >
> > I m usin the below method to delete a directory named testingfolder, will
> > this method delete all my jpeg files inside this directory will these
> files
> > also get deleted from hdfs along with the directory
> >
> > fileSystem.delete(
> > new Path("/user/testingfolder"),true);
>
>
>
> --
> Harsh J
>

Re: directory delete in hadoop

Posted by Harsh J <ha...@cloudera.com>.
Yes, if you delete a directory, its contents are recursively deleted.
If you do not want that to happen (i.e. you want a protective
measure), use http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
with false. And it will never delete a directory.

Sort of like rm vs. rm -r on *nix.

On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Harsh J

Re: directory delete in hadoop

Posted by Nitin Pawar <ni...@gmail.com>.
yes this will delete the entire directory and its contents (assuming
that user running the code has the permission to delete the directory)



On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Nitin Pawar

Re: directory delete in hadoop

Posted by Harsh J <ha...@cloudera.com>.
Yes, if you delete a directory, its contents are recursively deleted.
If you do not want that to happen (i.e. you want a protective
measure), use http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
with false. And it will never delete a directory.

Sort of like rm vs. rm -r on *nix.

On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Harsh J

Re: directory delete in hadoop

Posted by Nitin Pawar <ni...@gmail.com>.
yes this will delete the entire directory and its contents (assuming
that user running the code has the permission to delete the directory)



On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Nitin Pawar

Re: directory delete in hadoop

Posted by Harsh J <ha...@cloudera.com>.
Yes, if you delete a directory, its contents are recursively deleted.
If you do not want that to happen (i.e. you want a protective
measure), use http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
with false. And it will never delete a directory.

Sort of like rm vs. rm -r on *nix.

On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Harsh J

Re: directory delete in hadoop

Posted by Nitin Pawar <ni...@gmail.com>.
yes this will delete the entire directory and its contents (assuming
that user running the code has the permission to delete the directory)



On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Nitin Pawar

Re: directory delete in hadoop

Posted by Nitin Pawar <ni...@gmail.com>.
yes this will delete the entire directory and its contents (assuming
that user running the code has the permission to delete the directory)



On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Nitin Pawar

Re: directory delete in hadoop

Posted by Harsh J <ha...@cloudera.com>.
Yes, if you delete a directory, its contents are recursively deleted.
If you do not want that to happen (i.e. you want a protective
measure), use http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#delete(org.apache.hadoop.fs.Path,%20boolean)
with false. And it will never delete a directory.

Sort of like rm vs. rm -r on *nix.

On Wed, Sep 5, 2012 at 4:44 PM, nisha sharma <ni...@gmail.com> wrote:
> Hi,
>
> I m usin the below method to delete a directory named testingfolder, will
> this method delete all my jpeg files inside this directory will these files
> also get deleted from hdfs along with the directory
>
> fileSystem.delete(
> new Path("/user/testingfolder"),true);



-- 
Harsh J