16.21 Finding All Directories with the Same NameTime for a confession. I collect a lot of software. I have one disk filled with public-domain software. Some directories are "collections" like the Sun User Group tapes. It is likely that I might have the same program in two different directories. To prevent this waste of space, I create an index of directories and the path needed to reach them. If I have two directories with the same name, I would like to know about it. I might be able to delete one of the directories. A simple way to search for redundant directories is with the following command: find . -type d -print | \ awk -F/ '{printf("%s\t%s\n",$NF,$0);}' | \ sort [You might want to make this into an
alias or function . (10.1
)
--JP
] The
find
(17.1
)
command prints out all directories.
The
awk
(33.11
)
command uses the
slash ( misc ./X11/lib/X11/fonts/misc misc ./misc misc ./src/XView2/contrib/examples/misc misc ./src/XView2/fonts/bdf/misc misc ./src/XView2/lib/libxvin/misc misc ./src/XView2/lib/libxvol/misc misc ./src/XView2/misc
This could be converted into a shell script that takes arguments.
If no arguments are specified, I want it to default to the
argument
[You could also use this great idea for finding duplicate files.
Change the - |
|