Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!psuvm!frecp12!zeches
From: ZECHES@FRECP12.BITNET (Nicolas Zeches)
Newsgroups: comp.os.msdos.misc
Subject: Re: MOVE files, not copy.
Message-ID: <91063.120855ZECHES@FRECP12.BITNET>
Date: 4 Mar 91 16:08:55 GMT
References: <2851@krafla.rhi.hi.is> <5yN0X2w163w@cybrspc>
<1991Mar4.044236.4842@cs.mcgill.ca> <1011@caslon.cs.arizona.edu>
Lines: 55
Organisation: ECP-Paris France
In article <1991Mar4.044236.4842@cs.mcgill.ca>, storm@cs.mcgill.ca (Marc
WANDSCHNEIDER) writes:
>>
>> After a rather lengthy search through the MSDOS manual, I still am at a loss
>> on how to MOVE files instead of just copying them.
>>
>> IS there a way to do this without the aid of software, or do I have to copy
>> each file, and then go back and delete it...?
In article <1011@caslon.cs.arizona.edu>, tlglenn@cs.arizona.edu (Ted L. Glenn)
replies :
>
> I've always wondered if DOS had the move command. To the best of my
>knowledge there is none. The closest I could come was to write a batch file
>to do the job myself.
>
> move this.fil that.fil
>
> echo off
> if %1l == l goto err
> if %2l == l goto err
> copy %1 %2
> del %1
> goto end
> :err
> echo Insufficient parameters
> :end
>
>I typed this from memory, but I think it'll work.
>--
> -Ted L. Glenn "Don't worry, be happy!" <--Ack! Pffffhhht!
What i would just had is a 'ERRORLEVEL statement after the 'COPY' statement..
Indeed, if an error occurs on the copy command, it would erase the original
file. Just try the following :
@echo off
If %1.==. goto param
If %2.==. goto param
copy %1 %2
If errorlevel 1 goto copyerr
del %1
goto end
:param
echo Insufficient parameters...
goto end
:copyerr
echo Error copying %1
:end
and invoke it with MOVE file1.typ file2.typ
I hope this will answer your question :)
Nicolas Zeches
ZECHES@FRECP12.BITNET