Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. MOVE "C:UsersabcdeDesktopPractice_Folderbatch renamelocation1*.txt" "C:UsersabcdeDesktopPractice_Folderbatch renamelocation2"
  2. RENAME "C:UsersabcdeDesktopPractice_Folderbatch renamelocation2*-*" ???_????.txt
  3.  
  4. CD "C:UsersabcdeDesktopPractice_Folderbatch_renamelocatio‌​n1"
  5. for /R %%f in (*-*.txt) do call :copyFile %%f
  6. goto: eof
  7.  
  8. :copyFile
  9. xcopy %1 "C:UsersabcdeDesktopPractice_Folderbatch_renamelocatio‌​n2"
  10. set file=%~nx1
  11. rename file %str:-=_%
  12.  
  13. @ECHO ON
  14.  
  15. SET Loc1Dir=C:UsersabcdeDesktopPractice_Folderbatch_renamelocatio‌​n1
  16. SET Loc2Dir=C:UsersabcdeDesktopPractice_Folderbatch_renamelocatio‌​n2
  17.  
  18. CD /D "%Loc1Dir%"
  19. FOR /R %%F IN ("*-*.txt") DO CALL :copyFile %%~F %%~NXF
  20. GOTO: EOF
  21.  
  22. :copyFile
  23. SET copyfname=%~1
  24. SET fname=%~2
  25. SET fname=%fname:-=_%
  26. ECHO F | XCOPY /Y /F "%copyfname%" "%Loc2Dir%%fname%"
  27. :::XCOPY /Y /F "%copyfname%" "%Loc2Dir%
  28. :::REN "%copyfname%" "%fname%"
  29. GOTO :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement