Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 072010
 

How to perform checksum on a folder?

Answer:

Previous article told you how perform checksum on a file. How about to perform checksum on a folder?

A simple solution is to install md5deep

# sudo apt-get install md5deep

To perform checksum on a particular folder (input),

#  md5deep -l -r input

26ab0db90d72e28ad0ba1e22ee510510  input/2.txt
6d7fce9fee471194aa8b5b6e47267f03  input/3.txt
b026324c6904b2a9cb4b88d6d61c81d1  input/1.txt

That's so easy.

Reference: http://md5deep.sourceforge.net/

Feb 052010
 

Remove directory name from file path

Answer:

It is easy to use basename to remove directory name from file path

E.g.

# basename /tmp/test.txt
test.txt

# basename /tmp/test.txt .txt
test

If you supply the 2nd argument, it will remove the characters if they exist in the suffix of the input filename.