File / Directory Commands
From CastleCopsWiki
Contents |
[edit] MD (Make Directory)
Create a new directory
Example:
md new_dir
Arguments:
Path to the location of the new directory
Switches:
none
[edit] Ren (Rename)
Rename a file
Example:
ren c:\1234.log 2468.log
(Rename the log file '1234' TO '2468')
Arguments:
Path to original file, new filename
Switches:
none
[edit] XCopy (eXtended Copy)
Copy files and directories (more versatile than the Copy command)
Example:
xcopy c:\windows\my_file.txt c:\
(copy my_file.txt to the root directory of c:)
Arguments:
Path to the source file, path to the destination directory)
Switches:
/s
(copies the current directory and all subdirectories)
/h
(copies hidden and system files)
[edit] Del (delete)
Delete files
Examples:
del c:\my_file.txt
(deletes one file)
del c:\*.txt
(deletes all files with the 'txt' extension - use wildcards cautiously with this command)
Argument:
Path to the location of the file
Switches:
none required
[edit] RD (Remove Directory)
Delete a directory
Example:
rd c:\old_dir
(removes old_dir if empty)
rd old_dir /s
(removes old_dir and all subdirectories and files contained within)
Arguments:
Path to the location of the directory to be removed
Switches:
/s
(Removes the entire directory tree)
[edit] Attrib (Attribute)
Set or unset the attributes of a file or directory
Example:
attrib +r c:\my_file.txt
(makes my_file.txt read-only)
attrib -r -h c:\msdos.sys
(removes the read-only and hidden attributes from the msdos.sys file)
Arguments:
+ or -, r or h
+
sets an attribute,
-
clears an attribute
r
is the read-only attribute,
h
is the hidden attribute
path to file
Switches:
none required
