Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have problem with a batch file. I'd like to do this, but can't.
move *.* ..\newdir
overwriting existing.
I've tried
xcopy *.* ..\newdir
rd *.*
but does not work...!Any ideas ?
Ravey Dave

Ok what about:
xcopy drive:\path\olddir drive:\path\newdir /i /s /h /w /v /g /k /x /-y rd /s olddirI went nuts with all the xcopy options that I think *could* be of some use in you situation. See xcopy /? for more info(start>run>cmd>xcopy /?).
I assume no responsibility for lost data, back up first....

Copying the files isn't the problem, removing the directories after the copy is what I'm stuck on. What I could do with is a deltree command in XP...!
Thanks for your help Ravey Dave.

That's what the /s switch is on the rd command, it is the equivalent to deltree.
rd /? 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 director tree. /Q Quiet mode, do not ask if ok to remove a directory tree with /S

The problen with RD is that you have to specify the directory you need to delete, You can't use wildcards.
Maybe I should have provided more info to start with...!What I have is:
On my file server I have two directories
AUDIO which is writable only by the server admin account, which is then used by my kids, read only, for their music.Audio_TEMP which is world writable, but not used by my kids. When I rip my cd's I put them in the AUDIO_TEMP directory, and I want a bat file to run at scheduled times to move the contents from the AUDIO_TEMP directory to the AUDIO directory. Deleteing the contents when the copy is finished. As I don't know what the directory names are I can't specify them..
I'm not being rude, and I really appreciate your help in this matter.
Ravey Dave..

[edit: forgot to add the /d switch to match directories]
Don't worry I didn't think you were rude, just though you may have missed it.
It may be possible to use a for loop to add wildcards to the rd command:
for /d %%a in ("w?ld card dir*") do rd /s "%%~fa"If needs be the directory name can be made up from a variable. The double quotes are only nessacery if the directory name contains a space or an ampersand.
If you need anymore help with this script just ask; don't worry I won't flame you ;).

My problem has been solved....!
I stupidly relied on information given to me by work mates, people who's only experience of computers is playing World of Warcraft, that Dos7/Win98 DELTREE would not work with WinXP. How wrong they were, I tried it, it worked.Anyway thanks for all the help. I have decided I will lurk this forum, and maybe poke my head in from time to time, maybe we'll communicate again some day.
Again thanks a lot.
Ravey Dave.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |