6 Replies - 3241 Views - Last Post: 11 September 2017 - 06:10 AM Rate Topic: -----

#1 javauser1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 11-September 17

Java code for to check diff of folders and files with content

Posted 11 September 2017 - 02:47 AM

Hi,

I am trying to check the diff for folders and files with content through java code.
for that, I have approached like
> I read the source and target folders.
> Iterated the source folder and target folder separately and added all the files and folders names to the seperated list.
> trying to get file names from the list and make that as file object and thought to compare the two different files.

could you suggest if any other better process would be there for this?
the approach for this result would be highly appreciated.

Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Java code for to check diff of folders and files with content

#2 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6340
  • View blog
  • Posts: 25,562
  • Joined: 12-December 12

Re: Java code for to check diff of folders and files with content

Posted 11 September 2017 - 03:15 AM

Do not post questions in the tutorials section, question moved to Java forum.
Was This Post Helpful? 0
  • +
  • -

#3 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3423
  • View blog
  • Posts: 15,479
  • Joined: 20-September 08

Re: Java code for to check diff of folders and files with content

Posted 11 September 2017 - 03:39 AM

Your use case (to you) is probably quite clear. To me, not so much. You might know that 'diff' is a Unix utility. It works on text files. Do you want Unix diff functionality or do you mean something else?

This post has been edited by g00se: 11 September 2017 - 03:44 AM
Reason for edit:: Clarification

Was This Post Helpful? 0
  • +
  • -

#4 javauser1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 11-September 17

Re: Java code for to check diff of folders and files with content

Posted 11 September 2017 - 04:17 AM

View Postg00se, on 11 September 2017 - 03:39 AM, said:

Your use case (to you) is probably quite clear. To me, not so much. You might know that 'diff' is a Unix utility. It works on text files. Do you want Unix diff functionality or do you mean something else?

Hi. Unix utility is only for text files. my requirement would include folder which contains png files, JSON files, XML files, and String files.
is there any Apache commonio packages are there to retrieve all the files <b>along with folder name</b>.

Thanks.
Was This Post Helpful? 0
  • +
  • -

#5 IOExceptional  Icon User is offline

  • D.I.C Head

Reputation: 25
  • View blog
  • Posts: 131
  • Joined: 15-September 16

Re: Java code for to check diff of folders and files with content

Posted 11 September 2017 - 04:47 AM

Are you familiar with java.nio.file.Files? It contains various utility methods for working with files and directories. Specifically, this method may be of use to you.
Was This Post Helpful? 0
  • +
  • -

#6 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3423
  • View blog
  • Posts: 15,479
  • Joined: 20-September 08

Re: Java code for to check diff of folders and files with content

Posted 11 September 2017 - 04:54 AM

Quote

is there any Apache commonio packages are there to retrieve all the files <b>along with folder name</b>.

You don't need special libraries to do that. But we're wasting our time here: Don't describe the code you think you need or the steps. Describe the GOAL
Was This Post Helpful? 0
  • +
  • -

#7 javauser1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 11-September 17

Re: Java code for to check diff of folders and files with content

Posted 11 September 2017 - 06:10 AM

View Postg00se, on 11 September 2017 - 04:54 AM, said:

Quote

is there any Apache commonio packages are there to retrieve all the files <b>along with folder name</b>.

You don't need special libraries to do that. But we're wasting our time here: Don't describe the code you think you need or the steps. Describe the GOAL

Okay Mr. Could you have any idea or approach for to diff the folders and files, files with content through java code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1