If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Rating: | Display Modes |
#16
|
|||
|
|||
XCOPY Prompt
On 4/24/2012 4:43 PM, Char Jackson wrote:
On Tue, 24 Apr 2012 12:59:33 -0700, Bob wrote: On 4/24/2012 7:58 AM, Tecknomage wrote: On Tue, 24 Apr 2012 07:23:24 -0700, Bob wrote: On 4/23/2012 2:18 PM, Gene Wirchenko wrote: Dear Win7ers: I am working between two systems: an XP system and a 7 system. I copy files back and forth on a USB stick. Some of the filenames are long, and I have old utility software that is limited to the 8.3 file format. I need short filenames, and I can not trust the the short names generated by Windows will be consistent. I created a batch file to make a short filename version: del WFCNew.asp xcopy WorkFunctionCodes_New.asp WFCNew.asp /v del WFCNP01.asp xcopy WorkFunctionCodes_New_Process01.asp WFCNP01.asp /v Unfortunately, xcopy always asks me if the destination is a file or a directory. I can not see, in the switches, what to specify to say that it is always to be a file. Note that I am always copying ONE file. (Yes, I have verified that it is only one file to be copied per xcopy command.) What switch setting do I need, please? Sincerely, Gene Wirchenko Let me be more clear. Your xcopy (could just as easily be copy) should read something like: xcopy c:\my documents\WorkFunctionCodes_New.asp f: WFCNew.asp /v You have no source for the file and no destination for the file. The xcopy command doesn't know where the file is and where it should go. Open a cmd window, type help xcopy and learn how to use a dos type command line. If I were doing this I would first copy the files, then do a ren command on the usb stick, so my batch file would be: echo on cd F: (assumes F: is the USB Stick drive designation) del WFCNew.asp del WFCNP01.asp copy c:\directory where file is\WorkFunctionCodes_New.asp F: (assumes F: is the USB stick). copy c:\directory where file is\WorkFunctionCodes_New_Process01.asp F: ren WorkFunctionCodes_New.asp WFCNew.asp ren WorkFunctionCodes_New_Process01.asp WFCNP01.asp exit you may have to use " " around long file names. The above command-line will NOT work, should be: xcopy "c:\my documents\WorkFunctionCodes_New.asp" f:\WFCNew.asp /v Right. Thank you, but he did not have a source and destination for the file, therefore the batch file will not work. As others have said, you don't need to specify a path when you're working in the current directory. That behavior has been standard since the early days of DOS. Agreed, but in that case he needs to change the to the drive/directory/ in the batch file, and use copy, not xcopy. There is no reason to use xcopy for a single file copy. :-) -- “There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him.” ? Robert A. Heinlein |
Ads |
#17
|
|||
|
|||
XCOPY Prompt
On Tue, 24 Apr 2012 16:49:12 -0700, Bob Hatch
wrote: On 4/24/2012 4:43 PM, Char Jackson wrote: On Tue, 24 Apr 2012 12:59:33 -0700, Bob wrote: On 4/24/2012 7:58 AM, Tecknomage wrote: On Tue, 24 Apr 2012 07:23:24 -0700, Bob wrote: On 4/23/2012 2:18 PM, Gene Wirchenko wrote: Dear Win7ers: I am working between two systems: an XP system and a 7 system. I copy files back and forth on a USB stick. Some of the filenames are long, and I have old utility software that is limited to the 8.3 file format. I need short filenames, and I can not trust the the short names generated by Windows will be consistent. I created a batch file to make a short filename version: del WFCNew.asp xcopy WorkFunctionCodes_New.asp WFCNew.asp /v del WFCNP01.asp xcopy WorkFunctionCodes_New_Process01.asp WFCNP01.asp /v Unfortunately, xcopy always asks me if the destination is a file or a directory. I can not see, in the switches, what to specify to say that it is always to be a file. Note that I am always copying ONE file. (Yes, I have verified that it is only one file to be copied per xcopy command.) What switch setting do I need, please? Sincerely, Gene Wirchenko Let me be more clear. Your xcopy (could just as easily be copy) should read something like: xcopy c:\my documents\WorkFunctionCodes_New.asp f: WFCNew.asp /v You have no source for the file and no destination for the file. The xcopy command doesn't know where the file is and where it should go. Open a cmd window, type help xcopy and learn how to use a dos type command line. If I were doing this I would first copy the files, then do a ren command on the usb stick, so my batch file would be: echo on cd F: (assumes F: is the USB Stick drive designation) del WFCNew.asp del WFCNP01.asp copy c:\directory where file is\WorkFunctionCodes_New.asp F: (assumes F: is the USB stick). copy c:\directory where file is\WorkFunctionCodes_New_Process01.asp F: ren WorkFunctionCodes_New.asp WFCNew.asp ren WorkFunctionCodes_New_Process01.asp WFCNP01.asp exit you may have to use " " around long file names. The above command-line will NOT work, should be: xcopy "c:\my documents\WorkFunctionCodes_New.asp" f:\WFCNew.asp /v Right. Thank you, but he did not have a source and destination for the file, therefore the batch file will not work. As others have said, you don't need to specify a path when you're working in the current directory. That behavior has been standard since the early days of DOS. Agreed, but in that case he needs to change the to the drive/directory/ in the batch file, I think the presumption is that he already did that, even though he didn't show us that part. The script would have failed in a much different way if he had failed to do that. and use copy, not xcopy. There is no reason to use xcopy for a single file copy. :-) I, too, wondered why he didn't simply use the copy command, which cleanly gets around the issue he's currently having. OTOH, I posted a solution to his xcopy issue earlier today, so I guess he can use xcopy if he wants to. -- Char Jackson |
#18
|
|||
|
|||
XCOPY Prompt
On Wed, 25 Apr 2012 00:45:33 +0100, choro wrote:
On 24/04/2012 17:51, Gene Wirchenko wrote: On Mon, 23 Apr 2012 16:05:28 -0700, Bob wrote: On 4/23/2012 2:18 PM, Gene Wirchenko wrote: Dear Win7ers: I am working between two systems: an XP system and a 7 system. I copy files back and forth on a USB stick. Some of the filenames are long, and I have old utility software that is limited to the 8.3 file format. I need short filenames, and I can not trust the the short names generated by Windows will be consistent. I created a batch file to make a short filename version: del WFCNew.asp xcopy WorkFunctionCodes_New.asp WFCNew.asp /v ^1^^^^^^^^^^^^^^^^^^^^^^^ ^2^^^^^^^^ 1 is the source; 2 is the destination. [snip] I don't see a source and/or destination in your batch file. If the file is already on the USB stick, why don't use just use ren or rename? I want a copy with a different name. The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT & PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. There's nothing "simple" about all of that rigmarole. I fail to see the reason, and I fail to see why it would be any easier, to rename files in one folder versus another. Just rename them where they lie. -- Char Jackson |
#19
|
|||
|
|||
XCOPY Prompt
On 25/04/2012 02:39, Char Jackson wrote:
On Wed, 25 Apr 2012 00:45:33 +0100, wrote: On 24/04/2012 17:51, Gene Wirchenko wrote: On Mon, 23 Apr 2012 16:05:28 -0700, Bob wrote: On 4/23/2012 2:18 PM, Gene Wirchenko wrote: Dear Win7ers: I am working between two systems: an XP system and a 7 system. I copy files back and forth on a USB stick. Some of the filenames are long, and I have old utility software that is limited to the 8.3 file format. I need short filenames, and I can not trust the the short names generated by Windows will be consistent. I created a batch file to make a short filename version: del WFCNew.asp xcopy WorkFunctionCodes_New.asp WFCNew.asp /v ^1^^^^^^^^^^^^^^^^^^^^^^^ ^2^^^^^^^^ 1 is the source; 2 is the destination. [snip] I don't see a source and/or destination in your batch file. If the file is already on the USB stick, why don't use just use ren or rename? I want a copy with a different name. The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT& PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. There's nothing "simple" about all of that rigmarole. I fail to see the reason, and I fail to see why it would be any easier, to rename files in one folder versus another. Just rename them where they lie. But I thought he wanted *two* copies of the same file under different names. Hence my suggestion... Got it?! Otherwise you can rename a file in loco as you suggest. But you cannot rename a file in loco and still retain the old version with the old original filename. -- choro |
#20
|
|||
|
|||
XCOPY Prompt
On Wed, 25 Apr 2012 12:36:04 +0100, choro wrote:
On 25/04/2012 02:39, Char Jackson wrote: On Wed, 25 Apr 2012 00:45:33 +0100, wrote: On 24/04/2012 17:51, Gene Wirchenko wrote: On Mon, 23 Apr 2012 16:05:28 -0700, Bob wrote: On 4/23/2012 2:18 PM, Gene Wirchenko wrote: Dear Win7ers: I am working between two systems: an XP system and a 7 system. I copy files back and forth on a USB stick. Some of the filenames are long, and I have old utility software that is limited to the 8.3 file format. I need short filenames, and I can not trust the the short names generated by Windows will be consistent. I created a batch file to make a short filename version: del WFCNew.asp xcopy WorkFunctionCodes_New.asp WFCNew.asp /v ^1^^^^^^^^^^^^^^^^^^^^^^^ ^2^^^^^^^^ 1 is the source; 2 is the destination. [snip] I don't see a source and/or destination in your batch file. If the file is already on the USB stick, why don't use just use ren or rename? I want a copy with a different name. The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT& PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. There's nothing "simple" about all of that rigmarole. I fail to see the reason, and I fail to see why it would be any easier, to rename files in one folder versus another. Just rename them where they lie. But I thought he wanted *two* copies of the same file under different names. Hence my suggestion... Got it?! That's where xcopy (and copy, etc.) come in. They do exactly that, but without requiring you to move files somewhere else first. Otherwise you can rename a file in loco as you suggest. But you cannot rename a file in loco and still retain the old version with the old original filename. That's where xcopy (and copy, etc.) come in. They do exactly that, but without requiring you to move files somewhere else first. I sound like a broken record, but these kinds of basic file operations are, well, basic. They've been with us for over 30 years now. -- Char Jackson |
#21
|
|||
|
|||
XCOPY Prompt
On Wed, 25 Apr 2012 00:45:33 +0100, choro wrote:
[snip] The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT & PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. I have a batch file to keep it simple. Just type the name of the batch file, press Enter, and done. It does not get much simpler than that once one gets it working. Mousing about has to be repeated ad nauseum. Sincerely, Gene Wirchenko |
#22
|
|||
|
|||
XCOPY Prompt
On Tue, 24 Apr 2012 11:41:32 -0700, Bob Hatch
wrote: [snip] Once again, YOU DID NOT HAVE A SOURCE AND DESTINATION for the file. You must have a SOURCE AND DESTINATION for copy or xcopy to work. It's not an optional thing. I did. A filename is source and is a destination. Sincerely, Gene Wirchenko |
#23
|
|||
|
|||
XCOPY Prompt
On 4/25/2012 9:37 AM, Gene Wirchenko wrote:
On Tue, 24 Apr 2012 11:41:32 -0700, Bob wrote: [snip] Once again, YOU DID NOT HAVE A SOURCE AND DESTINATION for the file. You must have a SOURCE AND DESTINATION for copy or xcopy to work. It's not an optional thing. I did. A filename is source and is a destination. Sincerely, Gene Wirchenko I had, based on your post, assumed (I know, shouldn't do that) that you were copying the file to a new location and renaming it at the same time. What's the drive designation of the USB stick? E, F, G? -- “There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him.” ? Robert A. Heinlein |
#24
|
|||
|
|||
XCOPY Prompt
On 4/25/12 10:36 AM, Gene Wirchenko wrote:
On Wed, 25 Apr 2012 00:45:33 +0100, wrote: [snip] The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT& PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. I have a batch file to keep it simple. Just type the name of the batch file, pressEnter, and done. It does not get much simpler than that once one gets it working. Mousing about has to be repeated ad nauseum. Unless you use a macro recorder and have a shortcut to it. :-) -- Ken Mac OS X 10.6.8 Firefox 12.0 Thunderbird 12.0 LibreOffice 3.5.1.2 |
#25
|
|||
|
|||
XCOPY Prompt
On Wed, 25 Apr 2012 11:46:50 -0600, Ken Springer
wrote: On 4/25/12 10:36 AM, Gene Wirchenko wrote: On Wed, 25 Apr 2012 00:45:33 +0100, wrote: [snip] The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT& PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. I have a batch file to keep it simple. Just type the name of the batch file, pressEnter, and done. It does not get much simpler than that once one gets it working. Mousing about has to be repeated ad nauseum. Unless you use a macro recorder and have a shortcut to it. :-) Since many of my actions could not be done in a GUI, that would not work. Sincerely, Gene Wirchenko |
#26
|
|||
|
|||
XCOPY Prompt
On Wed, 25 Apr 2012 09:56:01 -0700, Bob Hatch
wrote: On 4/25/2012 9:37 AM, Gene Wirchenko wrote: On Tue, 24 Apr 2012 11:41:32 -0700, Bob wrote: [snip] Once again, YOU DID NOT HAVE A SOURCE AND DESTINATION for the file. You must have a SOURCE AND DESTINATION for copy or xcopy to work. It's not an optional thing. I did. A filename is source and is a destination. I had, based on your post, assumed (I know, shouldn't do that) that you were copying the file to a new location and renaming it at the same time. What's the drive designation of the USB stick? E, F, G? I gave you the exact command lines. Since neither drives nor directories were specified, the default ones apply. Sincerely, Gene Wirchenko |
#27
|
|||
|
|||
XCOPY Prompt
On Wed, 25 Apr 2012 11:08:10 -0700, Gene Wirchenko
wrote: On Wed, 25 Apr 2012 09:56:01 -0700, Bob Hatch wrote: On 4/25/2012 9:37 AM, Gene Wirchenko wrote: On Tue, 24 Apr 2012 11:41:32 -0700, Bob wrote: [snip] Once again, YOU DID NOT HAVE A SOURCE AND DESTINATION for the file. You must have a SOURCE AND DESTINATION for copy or xcopy to work. It's not an optional thing. I did. A filename is source and is a destination. I had, based on your post, assumed (I know, shouldn't do that) that you were copying the file to a new location and renaming it at the same time. What's the drive designation of the USB stick? E, F, G? I gave you the exact command lines. Since neither drives nor directories were specified, the default ones apply. I never saw any feedback as to whether my suggestion to use "echo f" was working for you, as spelled out he (I assume it did.) Message-ID: That seemed to work for me, as did changing from xcopy to the copy command. The prompt you're seeing doesn't occur with copy. -- Char Jackson |
#28
|
|||
|
|||
XCOPY Prompt
On 25/04/2012 15:48, Char Jackson wrote:
On Wed, 25 Apr 2012 12:36:04 +0100, wrote: On 25/04/2012 02:39, Char Jackson wrote: On Wed, 25 Apr 2012 00:45:33 +0100, wrote: On 24/04/2012 17:51, Gene Wirchenko wrote: On Mon, 23 Apr 2012 16:05:28 -0700, Bob wrote: On 4/23/2012 2:18 PM, Gene Wirchenko wrote: Dear Win7ers: I am working between two systems: an XP system and a 7 system. I copy files back and forth on a USB stick. Some of the filenames are long, and I have old utility software that is limited to the 8.3 file format. I need short filenames, and I can not trust the the short names generated by Windows will be consistent. I created a batch file to make a short filename version: del WFCNew.asp xcopy WorkFunctionCodes_New.asp WFCNew.asp /v ^1^^^^^^^^^^^^^^^^^^^^^^^ ^2^^^^^^^^ 1 is the source; 2 is the destination. [snip] I don't see a source and/or destination in your batch file. If the file is already on the USB stick, why don't use just use ren or rename? I want a copy with a different name. The simplest way is to copy and paste the file to another folder, rename it there and then drag and drop it to the original folder. IF they are in different drives then use the CUT& PASTE method.If you want both copies of the file in the same folder that is... Remember the motto, *Keep it simple*. There's nothing "simple" about all of that rigmarole. I fail to see the reason, and I fail to see why it would be any easier, to rename files in one folder versus another. Just rename them where they lie. But I thought he wanted *two* copies of the same file under different names. Hence my suggestion... Got it?! That's where xcopy (and copy, etc.) come in. They do exactly that, but without requiring you to move files somewhere else first. Otherwise you can rename a file in loco as you suggest. But you cannot rename a file in loco and still retain the old version with the old original filename. That's where xcopy (and copy, etc.) come in. They do exactly that, but without requiring you to move files somewhere else first. I sound like a broken record, but these kinds of basic file operations are, well, basic. They've been with us for over 30 years now. No need for xcopy at all. Just open the file, *Save as...* and give it a different filename -- may I suggest a dash or an underscore just before the dot and the file extension e.g. Filename-.doc or Filename_.doc And it's done! And you have 2 copies in the same folder. -- choro |
#29
|
|||
|
|||
XCOPY Prompt
On 25/04/2012 17:56, Bob Hatch wrote:
On 4/25/2012 9:37 AM, Gene Wirchenko wrote: On Tue, 24 Apr 2012 11:41:32 -0700, Bob wrote: [snip] Once again, YOU DID NOT HAVE A SOURCE AND DESTINATION for the file. You must have a SOURCE AND DESTINATION for copy or xcopy to work. It's not an optional thing. I did. A filename is source and is a destination. Sincerely, Gene Wirchenko I had, based on your post, assumed (I know, shouldn't do that) that you were copying the file to a new location and renaming it at the same time. What's the drive designation of the USB stick? E, F, G? Oh, my God! This is beginning to sound like that story of the computing teacher getting a phone call in the middle of the night from the old lady asking what could she do since her mouse was already at the edge of the desk and she still had to move it a bit more to click whatever she was going to click! -- choro |
#30
|
|||
|
|||
XCOPY Prompt
On 4/25/2012, choro posted:
On 25/04/2012 17:56, Bob Hatch wrote: On 4/25/2012 9:37 AM, Gene Wirchenko wrote: On Tue, 24 Apr 2012 11:41:32 -0700, Bob wrote: [snip] Once again, YOU DID NOT HAVE A SOURCE AND DESTINATION for the file. You must have a SOURCE AND DESTINATION for copy or xcopy to work. It's not an optional thing. I did. A filename is source and is a destination. Sincerely, Gene Wirchenko I had, based on your post, assumed (I know, shouldn't do that) that you were copying the file to a new location and renaming it at the same time. What's the drive designation of the USB stick? E, F, G? Oh, my God! This is beginning to sound like that story of the computing teacher getting a phone call in the middle of the night from the old lady asking what could she do since her mouse was already at the edge of the desk and she still had to move it a bit more to click whatever she was going to click! -- choro I like the analogy :-) -- Gene E. Bloch (Stumbling Bloch) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|