| 1. |
Solve : How to make a Batch file to create a directory & copy files to it as an archive? |
|
Answer» How would you go about making a batch file ( I understand that I could open notepad and just type the commands in, the only problem is I do not understand all of the commands or know of them) What I want to do is create a batch file in notepad and save the file as a .BAT. What I want to do next or before I save the file as a .bat is tell it to create a directory ( any REALLY ) and have it copy files to it as an archive. copy files to it as an archive.I am ASSUMING it is in reference to making a backup or archive, I assume copy all of the files that are in the directory once the directory is created. I am assuming i would use the archive command after I created the directory correct? I am new at this and I am doing this for a class so I am asking for guidance and all that was included in the instructions was "Create a Batch file to create a directory and copy files to it as an archive. The file name should be Archiveit." It doesn't help that we girls are not computer as computer advanced as you guys, lolwould this work for making the directory? md c:\directory1 And also do I have to write the echo off or on command prior to the md c: ******* And how would I copy files to it, would I just extract old files from another directory into it, and use the file attribute such as archive? Sorry this is a little confusingmaybe this will hep you understand it easier. Instruct your employees to create a Batch file to create a directory and copy files to it as an archive. So, when they are about to repair something, they can back up the appropriate directory by typing “Archiveit” after they have edited the batch file to include the source file and the destination. Usually assignments in class are to test what you have been TAUGHT by the teacher. Hasn't he or she covered this? Test the commands at the command prompt. When the commands work, copy the the commands to notepad and save as a archiveit.bat C:\>md archive C:\>copy *.* archive\ C:\>rmdir archive C:\>rmdir /? Removes (deletes) a directory. RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with /S C:\> C:\>md /? Creates a directory. MKDIR [drive:]path MD [drive:]path If Command Extensions are enabled MKDIR CHANGES as follows: MKDIR creates any intermediate directories in the path, if needed. For example, assume \a does not exist then: mkdir \a\b\c\d is the same as: mkdir \a chdir \a mkdir b chdir b mkdir c chdir c mkdir d which is what you would have to type if extensions were disabled. C:\>copy /? Copies one or more files to another location. COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] source Specifies the file or files to be copied. /A Indicates an ASCII text file. /B Indicates a binary file. /D Allow the destination file to be created decrypted destination Specifies the directory and/or filename for the new file(s). /V Verifies that new files are written correctly. /N Uses short filename, if available, when copying a file with a non-8dot3 name. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line. Default is to prompt on overwrites unless COPY command is being executed from within a batch script. To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format). C:\>copy *.* archive\ |
|