in reply to Find dup files and display the output of the script in /tmp dir
Update your post and show us that code, and what you've been trying to do to reach your goal, the point is to get a hands-on practical learning experience by interacting with Monks in the Monastery and we all care for everyone who shows to possess some learning potential..
check File::Compare, File and Directory Functions...
Best of Luck....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find dup files and display the output of the script in /tmp dir
by anthonyraj75 (Initiate) on Nov 30, 2009 at 11:10 UTC | |
This code is to find all the dup files and move to ./trash directory, but I wanted: 1. The dup files to remain as it is and 2. Display the dup files with the path and filesize in ./tmp directory without moving/removing any files. | [reply] [d/l] |
by gmargo (Hermit) on Nov 30, 2009 at 14:17 UTC | |
If you're going to copy code from another node (Re^2: Find duplicate files.) then at least use the download link, and not just copy/paste with the mouse. Then you won't have all those plus signs in there that show you have not even compiled ("perl -c file...") the downloaded code. If you want to start with that code, then all you'd have to do is to changed the rename statement so that it calls a non-damaging function instead. Then tweak to your heart's delight. Give It A Try. | [reply] [d/l] |
by biohisham (Priest) on Nov 30, 2009 at 16:11 UTC | |
I could not see the reason why a data structure like "$seen{"$md5:$filesize"}" should be used so instead I made the hash key be the filename only, considering that a duplicate file is identified by its name... The test text file 'fileMD5.txt' contains the following data:
Here is just an illustration of a concept that you can incorporate, it gives you a list of unique files on the STDOUT console and a list of those duplicates would be printed onto a temp file, my approach is open for criticism, modification and comments for I am a learner myself, best of luck:
Output to console:
Output to temp file:
Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind. | [reply] [d/l] [select] |