Advertisement
Guest User

dedup_restore_names.sh

a guest
Jan 24th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.36 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. topdir=$(realpath "$1")
  4. orig_path_dir="$topdir-orig_path"
  5. tmp_dedup_dir="$topdir-tmp_dedup"
  6.  
  7. find "$tmp_dedup_dir" -type f | while read -r unnamed_file ;
  8. do
  9.     namefile="$(basename "$unnamed_file")"
  10.     namefile_path="$orig_path_dir/$namefile"
  11.  
  12.     mv -v "$unnamed_file" "$topdir/$(cat $namefile_path)"
  13. done
  14.  
  15. rm -r "$orig_path_dir" "$tmp_dedup_dir"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement