4.1.3. Copy, move and delete |
The following commands apply to working with files and directories in terms of their transfers, name changes and deletions, without prejudice to change the contents of files, the simplest action, without major consequences for the file, use the command REN or RENAME (name change). Syntax commands to change the file name and its type is:
REN_[disk:][\path\]oldNAME.TYPE_newNAME.TYPE (Int)
The file type must not be changed because .COM file will not be made if the change type. Works will not immediately recognize his creation if not .WPS and the like. So, with changing the file type to be cautious. The file will not be executable only for the fact that its type is changed to .COM.
Directory name can not be changed with RENAME command.
Examples:
RENAME C:\DOS\README.TXT READ.UPT RENAME C:\DOS\READ.UPT README.TXT
The first command changes the old name of the file README.TXT in the new name READ.UPT. The second command changes the old name READ.UPT to a new README.TXT.
COPYING involves overwriting the file in its entirety to another location. Sure. under the same name can not be copied to the same location (same directory). Therefore, the command to copy files and provides the name change in this case, or if you want to copy a file to another location under another name. So also with copying enabled and change the name. Syntax COPY command to copy a file:
COPY_old#FS_new#FS_[/V] (Int) ====== =========== source destination
It is known, #FS - file specification includes the device, path, name and type.
Certain elements of the command means the following:
Source Location and file name of the want to copy. Destination Place the new file name in the location where the file want to copy. If the file is copied to the same directory must her in the destination specification to give a new behalf. If the file is copied to another Directory, can be copied with the same name and not to mention the name of the specification destination if it does not want to change. /V Switch that allows comparisons copied and source files regarding regularity copying. The copying time is slightly longer.
MOVE command moves a file from source to destination. The destination can specify a new file name, and also means a change of name. MOVE essentially means copying and deleting the source. The syntax is almost the same as the copy:
MOVE_old#FS_new#FS (Int) ====== =========== source destination
No switch for controlling regularity repackaging content. MOVE command to change the names and directories in a way that is given a new name in the destination directory, and the path to the directory must be the same in the source and destination. The syntax is:
MOVE_disk:\path\oldnameofDIRECTORY_disk:\path\newnameofDIRECTORY ============================= ============================= source destination
If the command COPY or MOVE wrong default OS will respond to the copy of 0 (zero) files. Otherwise, by copying the following report on the number of files copied.
COPY and MOVE commands allow JOKER use when copying or moving files. How then copy or move the entire group of files at the destination is then not allowed to define the name and type of file (not a group of files into one).
With changing the directory to be careful, especially if it is the name of a group of important programming, because it is registered in the name of the directory PATH in AUTOEXEC.BAT or in an initialization or configuration file, and in the case of a name change may happen that the parameters groups can not be set or program support to report errors.
Examples:
C:\> ---------------------- C:\>COPY C:\DOS\TREE.COM A:\IM1 1. section C:\DOS\>COPY TREE.COM A:\IM1 C:\> ---------------------- A:\>COPY C:\WINDOWS\SYSTEM\VER.DLL A:\IM2\ANTE.DLL 2. section C:\WINDOWS\SYSTEM\>COPY VER.DLL A:\IM2\STIPE.DLL C:\> ---------------------- C:\> C:\> ---------------------- C:\>MOVE A:\IM2\STIPE.DLL A:\IM3\STIPAN.DLL 3. section C:\>MOVE A:\IM2\ANTE.DLL A:\IM3 C:\> ---------------------- A:\IM3\>COPY *.DLL A:\IM2 4. section C:\> ---------------------- C:\>MOVE A:\IM4 A:\IM5 5. section C:\> ----------------------
In the first section, copy the file TREE.COM from the directory DOS on drive [C:] to directory IM1 on the floppy disk, once from the ROOT, and the second time from the DOS directory. In the second case, we should mention the entire specification of the source because the OS directory in DOS (which makes it show?).
The second section is copied file VER.DLL from subdirectories [SYSTEM] of directory [Windows] on the floppy disk to the directory IM2 with the name change, the first time from ROOT, the second time from the SYSTEM directory.
The third section moves files from one directory to another, for the first time with the change of names and the second time without changing the name.
The fourth section is copied all files of type .DLL from IM2 to IM3 in the drive [A:].
The fifth section changes the directory name IM4 in IM5 on the drive [A:] from drive [C:].
Copy of directories is possible if XCOPY (EXTENDED COPY) command is executed per syntax:
XCOPY_disk:\path\oldDIRECTORY_disk:\path\newDIRECTORY_[/S[/E]][/V] ======================= ==================================== (Ext) source destination
The path to the directory in the source and destination must be the same. The presented switches are used for:
/S Offers a full copy of all subdirectories. /E With /S can to copy empty subdirectories. It can not be set independently, but along with /S. /V Control correctness copying.
Examples:
C:\>XCOPY A:\IM5 A:\IM4 /S/E/V
Copies IM5 directory on the drive [A:] in the directory IM4 on the same device together with his full and empty subdirectories with copy control.
The simplest command from group for deleting is the CLS (CLEAR SCREEN), clears the screen and sets the prompt and the cursor to the top of the screen.
The syntax is:
CLS (Int)
Deleting files is done DEL or ERASE command. The syntax is:
DEL_[disk:][\path\]NAME.TYPE_[/P] (Int)
Should think twice before they use, so it is useful to add the switch ' /P ', which asks you to confirm deletion for each deletion. The danger is even greater because it allows the use of JOKER, and therefore the ability to delete groups of files.
Delete directory command DELTREE done. The syntax is:
DELTREE_[disk:][\path\]DIRECTORY (Ext)
Very dangerous command that deletes the entire tree and there is no return. It should be used carefully. For safety command has embedded query to confirm the deletion.
Examples:
C:\DOS\>ERA README.TXT C:\>ERA C:\DOS\README.TXT /P C:\> ---------------------- C:\>DELTREE C:\WINDOWS
The first command deletes the file from the directory where the file is. The second command does the same but from the ROOT of the device. The third command deletes the WINDOWS directory. Do not use it because there will be no windows.
UNDELETE command. It is possible to restore files through which new facilities are not enrolled. So the command should be used immediately after mistakenly performed deletion. The syntax is the simplest:
UNDELETE_[#FS] (Ext) UNDELETE_/LIST UNDELETE_/ALL
Switches and controls are used for accessories:
#FS File Specification, if not specified UNDELETE
tries to restore all deleted files and asks
confirmation to restore data if the file
intact upon entering the first letter of the file name.
/LIST Gives overview (without restoring) deleted
undamaged files to the directory where the OS.
/ALL Restores all deleted files in the directory intact
where is the OS and the OS determines the first
letter of files.
Examples:
C:\DOS\>UNDELETE README.TXT C:\>UNDELETE C:\DOS\README.TXT C:\> ---------------------- C:\>UNDELETE C:\WINDOWS /LIST C:\> ---------------------- C:\WINDOWS\>UNDELETE /ALL
The first and second command returns the README.TXT file in the DOS directory, the first from her directory and another from the ROOT. The third command from ROOT viewing deleted files intact in the WINDOWS directory, and the fourth from that folder automatically returned undamaged files.
Can not be restore a file that was deleted in the directory although the same is making again.
Citing of this page: Radic, Drago. " Informatics Alphabet " Split-Croatia. {Date of access}; https://informatics.buzdo.com/file. Copyright © by Drago Radic. All rights reserved. | Disclaimer |