Re: Consolidating? files



rob wrote:
I have an issue that I'm sure has a fairly simple resolution but I am
too inexperienced to figure it out. Basically I have a number of
files spread across several folders and subfolders in my home
directory. Some of these files are duplicates of each other and some
files have completely different content but share the same filename.
What I am trying to do is consolidate all the files in a single folder
with no duplicates and no overwriting files that have the same name.
Does anyone have any ideas how I might go about this?

BTW I am running FC5.

Any help would be greatly appreciated.

There are certainly a dozen ways to do this.

Off the top of my head I would use inside each directory

mv -i * ../newdirectory/

to move them all to the new directory. -i asks if you want to overwrite a filename. Always answer no.

Then

ls -ld directorya/* directoryb/* etc. >tempfile1

then

sort tempfile1 >tempfile2

Now tempfile2 will all the files with the same name clustere. Those which are the same size can be assumed to be the same file or you can check by hand. Then change the names of the duplicate names but different sizes and repeat the first step.

It would be wise to backup all the directories before starting.

--
Taxes on cigarettes are to raise revenues from the addiction.
-- The Iron Webmaster, 3759
nizkor http://www.giwersworld.org/nizkook/nizkook.phtml
Old Testament http://www.giwersworld.org/bible/ot.phtml a6
.



Relevant Pages

  • Re: Consolidating? files
    ... files spread across several folders and subfolders in my home ... with no duplicates and no overwriting files that have the same name. ... Now tempfile2 will all the files with the same name clustere. ...
    (linux.redhat)
  • [TOOL] matchreply: make procmail aware of threads and dups
    ... duplicated messages from different mailing lists. ... moving the thread to one of the folders I keep closer eye on ... regardless of the actual target delivery addresses. ... explain the -d option which matches for duplicates. ...
    (Linux-Kernel)
  • Re: Outlook shows duplicate names and folders
    ... Clarify what you mean by "shows all the duplicates." ... Do you mean duplicate folders or duplicate Contacts within each folder? ... Can you think of any changes you made to your Outlook setup just before the problem arose? ... Russ Valentine ...
    (microsoft.public.outlook.contacts)
  • Re: OT - Vista Search and Recursive GetFiles
    ... To ensure that the process goes ok I went to delete all the xml files to force a rescan of the tags. ... Since I had changed the folder structure not all were duplicated just the ones where folders were left the same. ... Oh it is the search indexer. ... I asked if a search which is correct would contain files that were not there or duplicates and of course the answer is yes. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: OT - Vista Search and Recursive GetFiles
    ... To ensure that the process goes ok I went to delete all the xml files to force a rescan of the tags. ... Since I had changed the folder structure not all were duplicated just the ones where folders were left the same. ... Oh it is the search indexer. ... I asked if a search which is correct would contain files that were not there or duplicates and of course the answer is yes. ...
    (microsoft.public.dotnet.languages.vb)