Computing.Net > Forums > Programming > Batch move

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch move

Reply to Message Icon

Name: Ravey Dave
Date: January 25, 2009 at 15:45:40 Pacific
OS: Windows XP
CPU/Ram: athlon xp 1800 /
Product: Made myself / Made myself
Subcategory: Batch
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Judago
Date: January 25, 2009 at 16:22:42 Pacific
Reply:

move /y *.* ..\newdir

??

It seemed to work fine for me....


0

Response Number 2
Name: Ravey Dave
Date: January 30, 2009 at 18:00:24 Pacific
Reply:

I need to move nested directories. This only works for files....! Thanks for your input, anyway..


0

Response Number 3
Name: Judago
Date: January 30, 2009 at 18:58:43 Pacific
Reply:

Ok what about:

xcopy drive:\path\olddir drive:\path\newdir /i /s /h /w /v /g /k /x /-y
rd /s olddir

I 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....


0

Response Number 4
Name: Ravey Dave
Date: February 1, 2009 at 11:17:11 Pacific
Reply:

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.


0

Response Number 5
Name: Judago
Date: February 1, 2009 at 23:43:04 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: Ravey Dave
Date: February 2, 2009 at 16:15:54 Pacific
Reply:

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..


0

Response Number 7
Name: Judago
Date: February 2, 2009 at 23:16:15 Pacific
Reply:

[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 ;).


0

Response Number 8
Name: Ravey Dave
Date: February 3, 2009 at 15:07:39 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch move

batch: moving files www.computing.net/answers/programming/batch-moving-files/11569.html

Batch Move Files From [list1] to [list2] www.computing.net/answers/programming/batch-move-files-from-list1-to-list2/19130.html

Batch move and rename files www.computing.net/answers/programming/batch-move-and-rename-files/19951.html