Something is wrong with my Bat file?

  • Thread starter Thread starter RScotti
  • Start date Start date
R

RScotti

Hi,
This is a portion of my bat file. The ones with the > are the questioned ones.

xcopy /s /y /d /h /c "C:\users\rls\Agent" "M:\Agent\"
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "D:\*.*" My D:\ partition
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "G:\*.*" My external HD
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "M:\*.*" My 8 GB Flash drive
xcopy /s /y /d /h /c "C:\Users\rls\Documents" "G:\Documents\"

When I run this I get and error message in the CMD prompt.
0 File(s) copied
C:\users\rls\RLS's Calendar.ics
C:\users\rls\AppData\Local\Microsoft\Windows Calendar\Calendars\RLS's Calendar.ics
2 File(s) copied
C:\users\rls\RLS's Calendar.ics
C:\users\rls\AppData\Local\Microsoft\Windows Calendar\Calendars\RLS's Calendar.ics
2 File(s) copied
C:\users\rls\RLS's Calendar.ics
C:\users\rls\AppData\Local\Microsoft\Windows Calendar\Calendars\RLS's Calendar.ics
File creation error - Incorrect function.

Unable to create directory - M:\Cookies
2 File(s) copied

For some reason my M:\ flash drive is trying to create a cookies folder and get the error Incorrect function.
The cookies folder is not in the same folder as the calendar and don't understand the Incorrect function.

There is only one file being created on these disks so I don't know why it is coping two files as it says?
This file IS in BOTH locations. I only put it in the RLS folder so I guess the program did the other one.

What do I have to change to stop this in my Bat file?

Have a good day,
RScotti

remove "nospam" in order to email me.
 
RScotti said:
Hi,
This is a portion of my bat file. The ones with the > are the questioned
ones.

xcopy /s /y /d /h /c "C:\users\rls\Agent" "M:\Agent\"
xcopy /s /y /d /h /c "C:\Users\rls\Documents" "G:\Documents\"

When I run this I get and error message in the CMD prompt.

For some reason my M:\ flash drive is trying to create a cookies folder
and get the error Incorrect function.
The cookies folder is not in the same folder as the calendar and don't
understand the Incorrect function.

There is only one file being created on these disks so I don't know why it
is coping two files as it says?
This file IS in BOTH locations. I only put it in the RLS folder so I guess
the program did the other one.

What do I have to change to stop this in my Bat file?

Have a good day,
RScotti

remove "nospam" in order to email me.

Instead of coding
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "D:\*.*"
get rid of the leading arrow head and code like so:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "D:\*.*"

Get rid of the trailing wild cards in the target parameters.
When using wild cards, use them for the source parameter only,
if at all:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics\*.*" "D:\"

Check what hidden files you have in the source folder.

Check if you have a folder called "RLS's Calendar.ics" in the
target folder.

If all fails, clean out your target folder completely before
trying again.
 
Hi Pagasus,
I was hoping to get you but didn't want to email you. I did all you suggestions except delete the target folder and it
did work except as I stated.
Please advise.

Instead of coding
get rid of the leading arrow head and code like so:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "D:\*.*"
I only put the > in to show which file I was talking about it isn't in the bat file.
Get rid of the trailing wild cards in the target parameters.
When using wild cards, use them for the source parameter only,
if at all:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics\*.*" "D:\"
Thanks. I did that.But this is a file not a folder? so I changed it to:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics "D:\Calendar.ics"
I don't know if that is the right syntax
or if "D:\Calendar.ics\" is right?
Check what hidden files you have in the source folder.
I do have shortcuts to cookies in the source folder and a few others.
Check if you have a folder called "RLS's Calendar.ics" in the
target folder.
Yes I did have a cookies folder in my M:\source folder but don't remember putting it there. I just deleted it.
If all fails, clean out your target folder completely before
trying again.

It did work but it kept asking me if it was a file or a folder. How do I change that?
I used:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics "D:\Calendar.ics"

Have a good day,
RScotti

remove "nospam" in order to email me.
 
Trying to send me an EMail would not have gotten you
anywhere - the address you see here is ficticious.

Your original post is a bit vague, so let's try to be
more specific. Please confirm that you're stumbling
over this particular command:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "M:\"

If this is correct then please restate the problem you
think you have with it.
 
First of all I have your temp email address you gave me from before.
But wouldn't use it as I said.

I think I fixed the problem. I changed the location of the file to a folder called Calendar and that seemed to fix it.
C:\users\rls\Calendar\RLS's Calendar.ics
1 File(s) copied
C:\users\rls\Calendar\RLS's Calendar.ics
1 File(s) copied
C:\users\rls\Calendar\RLS's Calendar.ics
1 File(s) copied

Trying to send me an EMail would not have gotten you
anywhere - the address you see here is ficticious.

Your original post is a bit vague, so let's try to be
more specific. Please confirm that you're stumbling
over this particular command:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" "M:\"

If this is correct then please restate the problem you
think you have with it.

Have a good day,
RScotti

remove "nospam" in order to email me.
 
PS:One last thing please.
If I was going to leave it the way it was as a file. How would I write it as to not get the prompt saying
Is this a file or directory?


First of all I have your temp email address you gave me from before.
But wouldn't use it as I said.

I think I fixed the problem. I changed the location of the file to a folder called Calendar and that seemed to fix it.




Have a good day,
RScotti

remove "nospam" in order to email me.

Have a good day,
RScotti

remove "nospam" in order to email me.
 
On 6/4/2007 8:48 AM On a whim, RScotti pounded out on the keyboard
PS:One last thing please.
If I was going to leave it the way it was as a file. How would I write it as to not get the prompt saying
Is this a file or directory?




Have a good day,
RScotti

remove "nospam" in order to email me.

Leave out the destination name:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics D:\

Because you stated a name (D:\Calendar.ics), Windows doesn't know
whether you want to create a folder in the root of D called Calendar.ics
or whether you are naming a file, so it asks.

--
Terry R.

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
To suppress this prompt, add a backslash to the destination
folder name like so:

xcopy "c:\Some Folder\*.*" "D:\Some Other Folder\"
 
Thanks again for helping me. I appreciate it.
To suppress this prompt, add a backslash to the destination
folder name like so:

xcopy "c:\Some Folder\*.*" "D:\Some Other Folder\"

Have a good day,
RScotti

remove "nospam" in order to email me.
 
Thanks to you too Terry for your help.
On 6/4/2007 8:48 AM On a whim, RScotti pounded out on the keyboard


Leave out the destination name:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics D:\

Because you stated a name (D:\Calendar.ics), Windows doesn't know
whether you want to create a folder in the root of D called Calendar.ics
or whether you are naming a file, so it asks.

Have a good day,
RScotti

remove "nospam" in order to email me.
 
Terry said:
On 6/4/2007 8:48 AM On a whim, RScotti pounded out on the keyboard


Leave out the destination name:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics D:\

Because you stated a name (D:\Calendar.ics), Windows doesn't know whether
you want to create a folder in the root of D called Calendar.ics or
whether you are naming a file, so it asks.

I recommend you test the above command. It won't work.
 
Tested it didn't work for me. Thank you again, Your are absolutely right.
I Don't know what I would do without your help. You are the expert when it comes to bat files that's why I was hoping to
get you to respond.
I recommend you test the above command. It won't work.

Have a good day,
RScotti

remove "nospam" in order to email me.
 
On 6/4/2007 10:16 AM On a whim, Pegasus pounded out on the keyboard
I recommend you test the above command. It won't work.

Yes, I did forget the closing ". Should be:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" D:\

--
Terry R.

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
Terry said:
On 6/4/2007 10:16 AM On a whim, Pegasus pounded out on the keyboard


Yes, I did forget the closing ". Should be:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" D:\

This will work but it's not a useful solution if the OP's
target folder is something other than the root of drive D:.
As I wrote before, adding a trailing slash to the target
folder will prevent the prompt from popping up:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" D:\SomeFolder\
 
No problem, I make several mistakes every day. :)
On 6/4/2007 10:16 AM On a whim, Pegasus pounded out on the keyboard


Yes, I did forget the closing ". Should be:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" D:\

Have a good day,
RScotti

remove "nospam" in order to email me.
 
On 6/4/2007 11:03 AM On a whim, Pegasus pounded out on the keyboard
This will work but it's not a useful solution if the OP's
target folder is something other than the root of drive D:.
As I wrote before, adding a trailing slash to the target
folder will prevent the prompt from popping up:

xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics" D:\SomeFolder\

If you look at it, my response other than the missing " was the same as
yours. I added the trailing slash (D:\) in the example. If the OP
understood that, he would have added a trailing slash at the end of the
destination. But in his example, he was not using a sub folder, so
eliminating the redundant name after D:\ would have eliminated the
prompt also.

--
Terry R.

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
Terry R. said:
On 6/4/2007 11:03 AM On a whim, Pegasus pounded out on the keyboard


If you look at it, my response other than the missing " was the same as
yours. I added the trailing slash (D:\) in the example. If the OP
understood that, he would have added a trailing slash at the end of the
destination. But in his example, he was not using a sub folder, so
eliminating the redundant name after D:\ would have eliminated the prompt
also.

You are quite right, of course, but your explanation
disagrees with your previous recommendation to the
OP: "Leave out the destination name". It should have
read "Add a back slash to the destination".
 
On 6/4/2007 12:30 PM On a whim, Pegasus pounded out on the keyboard
You are quite right, of course, but your explanation
disagrees with your previous recommendation to the
OP: "Leave out the destination name". It should have
read "Add a back slash to the destination".

No, adding the destination name is what was causing the prompt. The OP
wasn't saving the file to D:\Calendar.ics\, he was saving the file to
D:\, correct? This was what he wrote:

It did work but it kept asking me if it was a file or a folder.
How do I change that?
I used:
xcopy /s /y /d /h /c "C:\users\rls\rls's Calendar.ics "D:\Calendar.ics"

(I just copy and pasted his text, so that is why the trailing " was
missing anyway), so my reply to him was correct at the time (eliminating
the file name). If he would have used a sub folder in his example, I
would have told him to add a trailing back slash, but it appeared he was
copying to the root of D.

--
Terry R.

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
Back
Top