Results 1 to 3 of 3

Thread: check a directory for unique files

  1. #1
    Join Date
    Sep 2009
    Beans
    32

    check a directory for unique files

    hi. I have a directory containing lots of files and i want to make sure that they are all unique. I thought of performing a hash check and checking for any duplicates. But how can i do that in a bash script using one for loop since there is no way to store arrays ? Since there is no way to store stuff i will have to make use of two for loops. But is there a much easier method ? or maybe a tool to do this for me ?

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,358
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: check a directory for unique files

    You can do it in stages using files. For example:
    - You can get all the sums into a file.
    - Then, check the file for duplicates.

    Tell us if you need more directions.
    Regards.

  3. #3
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: check a directory for unique files

    You can use arrays in bash: http://mywiki.wooledge.org/BashGuide/Arrays

    But you could simply use fdupes. It's in the repositories.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •