Last active
March 26, 2017 15:49
-
-
Save A-Programmer/6bf2fa2e5bc9c0f60df063b59cbd41c0 to your computer and use it in GitHub Desktop.
Create directory,delete directory,create file, delete file,copy file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create directory : | |
mkdir DirectoryName | |
mkdir MrSadin | |
2. Navigate to directory : | |
cd DirectoryName (Or Path) | |
cd MrSadin | |
3. Delete Empty Directory : (Attention, directory should be empty) | |
rmdir DirectoryName | |
rmdir MrSadin | |
4. Delete directory that contains some files | |
rmdir /s DirectoryName | |
5. Create empty file : | |
echo. > fileName.extension | |
echo. > TestFile.txt | |
6. Create file with content : | |
echo. Your-Content > fileName.extension | |
echo. This is my file > Test.txt | |
7. Delete file : | |
del fileName | |
del TestFile.txt | |
del Test.txt | |
8. Copy a single file: | |
copy C:\Users\desktop\Example.txt D:\backup\Example.txt | |
9. Copy all of the files in a folder: | |
copy C:\Users\desktop\*.* D:\backup | |
10. Copy files when the file or folder has a space in the name: | |
copy "C:\Users\My Documents\*.*" "D:\2015 Backup" | |
11. Combine (concatenate) text files | |
copy file1.txt+file2.txt newFile.txt | |
12. Copy a folder to another location | |
xcopy C:\tools\* D:\backup\tools /e /i | |
/e tells xcopy to copy all of the subdirectories in the source location as well. This includes any empty directories. | |
/i tells xcopy to assume that the destination is a folder. This will force it to create the new folder during the copy process. | |
It is most useful when copying files from a CD or DVD. It will remove the Read-Only attribute automatically during the copy process. | |
13. Use xcopy to copy hidden files | |
xcopy C:\tools\* D:\backup\tools /e /i /h | |
14. Use robocopy to easily copy folders. The robocopy command replaces the xcopy command. It can quickly copy entire folders without having to worry about defining the contents. For example, to copy all of the contents of the C:\tools directory to the new folder D:\backup\tools, enter the following: | |
robocopy C:\tools D:\backup\tools /e | |
16. Mirror a directory. Mirroring a directory is great for making backups. The mirror option of robocopy will copy all of the contents from the source to the destination. It will then delete anything at the destination that doesn't exist at the source. This ensures that your backup only has the latest versions of your files. For example, to mirror C:\Users\My Documents to D:\backup\My Documents, enter the following | |
robocopy "C:\Users\My Documents" "D:\backup\My Documents" /mir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment