Repository is archived
No commit activity in last 3 years
No release in over 3 years
duplicated_filename_checker is check duplicated filename in multiple directory with subdirectory.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.6
~> 10.0
 Project Readme

Gem Version Build Status Coverage Status Code Climate

DuplicatedFilenameChecker

duplicated_filename_checker is duplicate file name checker in multiple directory with subdirectory.
This tool is checking only filename, not checking file content.

Installation

install:

$ gem install duplicated_filename_checker

Usage

survey duplicate filename

$ dup-filename ./survey_dir1_root ./survey_dir2_root

## dupfilename1.png
1. /Users/shinya131/survey_dir1_root/dupfilename1.png
 * md5: 5b915134b95109c68e7515f4737c5e6d
 * mtime: 2015-03-03 15:14:35 +0900

2. /Users/shinya131/survey_dir2_root/subdirectory/dupfilename1.png
 * md5: 5b915134b95109c68e7515f4737c5e6d
 * mtime: 2015-03-03 15:14:35 +0900

## dupfilename2.dat
1. /Users/shinya131/survey_dir1_root/dupfilename2.dat
 * md5: 5f524466f49b96221fe7c5a6ddf5d881
 * mtime: 2014-10-16 20:19:07 +0900

2. /Users/shinya131/survey_dir2_root/dupfilename2.dat
 * md5: 5ca13f9af7db4c8e80ac153fd4c0a552
 * mtime: 2015-03-03 15:14:35 +0900

only filename option: -l

$ dup-filename -l ./survey_dir1_root ./survey_dir2_root
dupfilename1.png
dupfilename2.dat

ignore option: -i

$ dup-filename -l -i .dat ./survey_dir1_root ./survey_dir2_root
dupfilename1.png

Usage duplicated_filename_checker as library

You can use duplicated_filename_checker in ruby program.

install

Add this line to your application's Gemfile:

gem 'duplicated_filename_checker'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install duplicated_filename_checker

example

require 'duplicated_filename_checker'

servey_root_paths = ['./survey_dir1_root', './survey_dir2_root']
duplicate_file_profile_list = DuplicatedFilenameChecker::Check.new(*servey_root_paths).execute

p duplicate_file_profile_list
#=>
# {
#   "dupfilename1.png"=>
#   [
#     #<DuplicatedFilenameChecker::FileProfile:0x007f9aa4878188 @file_path=...>,
#     #<DuplicatedFilenameChecker::FileProfile:0x007f9aa48633a0 @file_path=...>
#   ],
#   "dupfilename2.dat"=>
#   [
#     #<DuplicatedFilenameChecker::FileProfile:0x007f9aa4878160 @file_path=...>,
#     #<DuplicatedFilenameChecker::FileProfile:0x007f9aa4863210 @file_path=...>
#   ]
# }

duplicate_file_profiles = duplicate_file_profile_list['dupfilename1.png']
duplicate_file_profile = duplicate_file_profiles.first

p duplicate_file_profiles[0].path
#=> /Users/shinya131/survey_dir1_root/dupfilename1.png

p duplicate_file_profiles[1].path
#=> /Users/shinya131/survey_dir2_root/subdirectory/dupfilename1.png