1. Deduplication

Removal of duplicate files on the SMRU-SRV file server. All duplicates are replaced by hard links.

  • Copy the body of the Duplicate Files email from FSRM to the empty C:\Tmp\Clean.bat file using the vim editor.

  • Contents of the clean.vim script file.

    :%s/\r//g                                               # Remove CR characters.
    :%s/\s\+$//g                                            # Remove white space at end of lines.
    
    :%s/^To top of the current report/\tD:/g                # Convert separator lines to "<tab>D:" lines.
    :g!/\tD:/d                                              # Deleta all lines not containing "<tab>D:".
    :%s/^\tD:$//g                                           # Convert separator lines to empty lines.
    
    :%s/^\(.*\)\t\(.*\)$/"\2\\\1"/g                         # Move file names to end of folder names.
    
    :%s/\v\zs(".*")\ze\n(".*")/del \2 \& mklink \/h \2 \1/g # Delete 2nd file and make hard link for 2nd file to 1st file.
    :g/^".*"$/d                                             # Deleta all lines containing ".*".
    
    :w                                                      # Save changes.
    :q                                                      # Quit.
  • Enter the following commands at a Command Prompt.

    vim -c ":%s/\s\+#.*$//g" -c ":wq" C:\Tmp\Clean.vim > nul
    vim -s C:\Tmp\Clean.vim C:\Tmp\Clean.bat > nul
  • Enter the following commands at a Command Prompt.

    net use T: \\SMRU-SRV\Teams$ /P:No /U:SMRU\ADadmin
    net use U: \\SMRU-SRV\Home$  /P:No /U:SMRU\ADadmin
    C:\Tmp\Clean.bat