0

I have a problem regarding to copying files,

Problem : I have a list of md5sum, and a folder having 1000+ files, How can I move
files from folder to another folder with the help of md5sum list.

I can take md5sum against all files, currently present in folder, now what script
to to get read scripts from a list then compare the md5sum with list's
md5sum. If they are matched than the script move to another location.

Reading md5sum of files (little code)

for i in ls ; do md5=md5sum "${i}" ;

I don't know what condition will come here! to read list and compare with lists md5sum
; mv "${i}" $m ; done

If it's possible then please guide me how can I do this?

1
  • I have md5sum, mean I am able to get md5sum (filename) if file md5sum is matched with the list then something in script to move the folder to another location. – Muhammad Abdullah Dec 19 '13 at 15:16
1

something like this?

find . -maxdepth 1 -type f -print0|xargs -0r md5sum|\
sed 's!^\([0-9a-f]\{32\}\)[     ]\+\(.*\)$!mkdir \1; mv -it \1 "\2"!'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.