|
Answer» I need help with the following question:
I have a directory on my c:\ called BOB. It has a lot of subdirectories and files in it. I want to use XCOPY to copy the BOB directory to the SAVE directory on my D:\ And I want XCOPY to copy all the directories including the empty ones. I want XCOPY to copy all the hidden and system files. I also want XCOPY to prompt me before creating destination file. Please show me the complete command from the c:\> to use the XCOPY command with the switches needed to accomplish the above. DO NOT add more switches than what are called for. DO NOT use the CD command or start anywhere other than c:\
I got this: C:\WINDOWS\System32>xcopy c:\BOB D:\SAVE /E /H /P Is this correct?
And this second question, I am completely lost...
On your C: drive you have a directory named HOMEWORK, in the HOMEWORK directory you have a directory named ENGLISH. In the ENGLISH directory you have a directory named STUFF. You have your final presentation paper in the STUFF directory named english.txt.
Windows is acting weird and you can't get into your files, and your presentation paper is due today. What are you going to do? You realize you can bring up the command line. You are in a hurry and you PUT your usb drive in and need to copy the english.txt file to your usb drive which is drive e:\. On drive e:\ you have a directory named PRINT.
Show me the complete command to copy the english.txt file to the PRINT directory on the e:\ and name it efinal.txt. NOTE: Start from the c:\ and do this in ONE command on ONE line. DO NOT use the CD command or start anywhere other than c:\
We don't do homework here...sorry.I would apply wild cards of *.* to apply to all files and file extensions.
xcopy c:\BOB\*.* D:\SAVE\*.* /E /H /P
Cant help much further as for maybe they havent covered wild cards, but thinking you will learn from PROBLEMS and sharing further problems here. For the fact that you did provide some work that is your own and arent just looking for an answer, I will help with this a little bit.
As per your second question, its quite simple to achieve, and with enough research (Google or Textbook ) you wouldnt need anyone to do it for you and would be able to assemble your own instructions based on the thousands of other examples out there that are similar. I cant think of a way to help without giving the complete answer away other than with the skills your at in your learning, you have all you need to achieve it with the correct pathing and you can target the file specific to its actual path or grab it through a selective wildcard such as *.txt to not have to type out the entire name of the file and grab all *.txt files from a target path.
Here is a listing of all the switches and what they do as well for xcopy
Quote Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\>xcopy/? Copies files and directory trees.
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/EXCLUDE:file1[+file2][+file3]...]
source Specifies the file(s) to copy. destination Specifies the location and/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. Each string should be in a separate line in the files. 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 the size of 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. /L Displays files that would be copied. /G Allows the copying of encrypted files to destination that does not support encryption. /H Copies hidden and system files also. /R Overwrites read-only files. /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories. /U Copies only files that already exist in destination. /K Copies attributes. Normal Xcopy will reset read-only attributes. /N Copies using the generated short names. /O Copies file ownership and ACL information. /X Copies file audit settings (implies /O). /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. /B Copies the Symbolic Link itself versus the target of the link. /J Copies using unbuffered I/O. Recommended for very large files.
The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line.
C:\>
The Internet was not created so that you could dump your homework assignments verbatim into a Q&A forum for someone to do it for you. You will never learn to do anything for yourself if that is how you want to get through life.
Quote from: Squashman on November 19, 2017, 03:06:21 PMThe Internet was not created so that you could dump your homework assignments verbatim into a Q&A forum for someone to do it for you. You will never learn to do anything for yourself if that is how you want to get through life.
Ok, well I never asked for someone to do it for me. I just wanted a guide from a more personal source because the 2nd question was very specific and I still wasn't able to figure it out after reading through the my textbook and researching online. Also, I don't believe it is your place to decide how the Internet should be used. In fact, the Internet was created to ENABLE computers to connect and share information between universities, but obviously, that has changed over the YEARS. I did not know where else to turn to for help, so instead of trying to belittle me and giving me a life lesson, you could have shared another place I could have gone to for this, or not say anything at all.
Sorry if I offended anyone with this post.What is strange is why anybody would tell anybody to study DOS batch scripts for any reason. It is a skill that will die like magnetic memory bead threading.
Might as well teach students Latin. Thinking about it, , Latin has more promise
Image for Wikipedia.
Quote from: Sooshi4u on November 19, 2017, 05:01:05 PMI still wasn't able to figure it out after reading through the my textbook and researching online.
So you didn't read the help file?
Code: [Select]Microsoft Windows [Version 10.0.15063] (c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\Squashman>copy /? Copies one or more files to another location.
COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/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. /L If the source is a symbolic link, copy the link to the target instead of the actual file the source link points to.
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:\Users\Squashman> Ignore all the command line switches for the copy command and the help file says.
Code: [Select]copy source destination source Specifies the file or files to be copied. destination Specifies the directory and/or filename for the new file(s). So lets break that down. Essentially copying a file you have to know the SOURCE of the file and the DESTINATION of the file. The source and destination are clearly defined in your homework assignment.
SOURCE: On your C: drive you have a directory named HOMEWORK, in the HOMEWORK directory you have a directory named ENGLISH. In the ENGLISH directory you have a directory named STUFF. You have your final presentation paper in the STUFF directory named english.txt.
DESTINATION: copy the english.txt file to your usb drive which is drive e:\. On drive e:\ you have a directory named PRINT. copy the english.txt file to the PRINT directory on the e:\ and name it efinal.txt.
So tell me what your source and destinations are?
Quote from: Geek-9pm on November 19, 2017, 06:15:16 PMWhat is strange is why anybody would tell anybody to study DOS batch scripts for any reason. It is a skill that will die like magnetic memory bead threading.
Might as well teach students Latin. Thinking about it, , Latin has more promise
Image for Wikipedia.
A) They are NOT DOS batch scripts any more. B) Saying that is like telling a Unix admin they can't write BASH scripts anymore. C) CMD.exe and Windows have a lot more commands to play with then DOS did. D) My department generates $16 Million dollars a year in revenue off of the automation I design using batch files. E) I went to a Catholic High School. They stopped teaching Latin at my high school in the 80's!
He closed his account...
Quote from: Squashman on November 19, 2017, 07:18:31 PM So lets break that down. Essentially copying a file you have to know the SOURCE of the file and the DESTINATION of the file. The source and destination are clearly defined in your homework assignment.
SOURCE: On your C: drive you have a directory named HOMEWORK, in the HOMEWORK directory you have a directory named ENGLISH. In the ENGLISH directory you have a directory named STUFF. You have your final presentation paper in the STUFF directory named english.txt.
DESTINATION: copy the english.txt file to your usb drive which is drive e:\. On drive e:\ you have a directory named PRINT. copy the english.txt file to the PRINT directory on the e:\ and name it efinal.txt.
So tell me what your source and destinations are?
so... copy c:\HOMEWORK\ENGLISH\STUFF\english.txt E:\PRINT\efinal.txt ?? I'm not sure how to RENAME itC:\Save xcopy bob /s /h
|