home *** CD-ROM | disk | FTP | other *** search
- @echo off
- echo.
- echo ┌───────────────────────────────────────────────────┐
- echo │ Move file(s) from one directory to another │
- echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 25-Jan-92 │
- echo └───────────────────────────────────────────────────┘
- echo.
-
- rem Give help if needed
- if "%2"=="" goto _help
-
- rem Check that the source file(s) exists
- if exist %1 goto _label1
- echo File(s) %1 not found
- goto _out
-
- rem Check that the target directory exists
- :_label1
- if exist %2nul goto _label2
- if exist %2\nul goto _label2
- echo The target directory %2 not found
- goto _out
-
- rem Check that the target files do not already exits
- :_label2
- if exist %2%1 goto _exist
- if exist %2\%1 goto _exist
- goto _label3
-
- rem Error message for existing target files
- :_exist
- echo File(s) %1 already exist(s) in %2
- goto _out
-
- rem Copy the file(s)
- :_label3
- copy %1 %2 > nul
- echo File(s) %1 copied to %2
-
- rem Check that the target files now exist
- if exist %2%1 goto _exist2
- if exist %2\%1 goto _exist2
- goto _out
-
- rem Now remove the original files
- :_exist2
- del %1
- echo Original file(s) %1 deleted
- goto _out
-
- :_help
- echo Usage: MVE FromFileWithNoPath ToDirectory
- if "%1"=="" goto _out
- echo.
- echo The ToDirectory parameter is missing
-
- :_out
- echo on
-