File Management Commands

 

Copy

Copies files from one location to another. The destination defaults to the current directory. If multiple source files are indicated, the destination must be a directory, or an error will result.

copy filespec [destination]

 

Del

Deletes one or more files.

del filename
erase filename
*.*  All files in current folder
*.* /s all files in current folder and sub folders,

 

erase

erase filename
*.*  All files in current folder
*.* /s all files in current folder and sub folders,

 

 

ren

 

Renames a file. Unlike the move command, this command cannot be used to rename subdirectories, or rename files across drives.

 

ren filename newname

 

You can rename files in another directory by using the PATH parameter:

ren [path]|[filename] [newfilename]

An example could be:

ren c:\Windows filex.txt filey.txt

 

On DOS with long filename support, care must be taken when directories have spaces in their names like “Documents and Settings”. In these cases double-quotes are used to enclose them:

ren c:\”Documents and On DOS with long filename support, care must be taken when directories have spaces in their names like “Documents and Settings”. In these cases double-quotes are used to enclose them:

ren c:\"Documents and Settings"\"All Users"\Desktop filex.txt filey.txt

Mass renames can be accomplished by the use of wildcards. For example, the following command will change the extension of all files in the current

directory which currently have the extension htm to html:

ren *.htm *.html

 

attrib

Change or view the attributes of one or more files

 

About xcopy

Xcopy is a powerful version of the copy command with additional features; has the capability of moving files, directories, and even whole drives from one location to another.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]…]

source Specifies the file(s) to copy.
destination Specifies the location or name of new files.
/A Copies only files with the archive attribute set, doesn’t change the attribute.
/M Copies only files with the archive attribute set, turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/EXCLUDE:file1 [+file2][+file3]… Specifies a list of files containing strings. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.

 

BACKUP

BACKUP [d:][path][filename] [d:][/S][/M][/A][/F:(size] [/P][/D:date] [/T:time] [/L:[d:][path]filename]

 Makes a backup copy of one or more files. (In DOS Version 6, this program is stored on the DOS supplemental disk.)

 

RESTORE

Syntax:

RESTORE d: [d:][path]filename [/P][/S][/B:mm-dd-yy] [/A:mm-dd-yy] [/E:hh:mm:ss] [/L:hh:mm:ss] [/M][/N][/D]

Restores to standard disk storage format files previously stored using the BACKUP command. The DOS 6 RESTORE command can restore files that were backed up using the BACKUP command in DOS Versions 2.0 through 5.0.

 

Registration


A password will be e-mailed to you.

Feedback Form

Name (required)

Email (required)

Feedback