• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Making a "batch" or "vbscript" do this...

DocDoo

Golden Member
Currently I've been running a fairly basic (command) batch file that copies files named *.log from drive E: to drive F:\destination then delete all files (*.*) on drive E:.

Now I need a different batch script because of software changes.

Q: What I need the new script to do?

A: Copy only *.log and *.ghm from drive E:\unknown\folders\ to F:\destination then delete everything (files & folder\subfolder) on drive E:

The tricky part is, the folders & subfolders on source (E) are always different and never named the same, so the location of the 2 files (*.log & *.ghm) are not always known (except that they are within drive E).

A bonus would be to be able ignore same named files (source/destination).

This can be in .BAT or .VBS format. (BAT would be cleaner for me and allow me to recompile it)

-Thanks
 
Well, answering my own questions again 😉

I decided to use the XXCOPY command with some clever switches. The end result is very clean and easily recompiled.

ps. If someone finds a different way to do this outside of DOS, chime in.

 
I was going to offer the following but it looks like you already figured it out. I didn't bother testing this because theres really no point now, but here it is for reference anyways =p

I needed to test rmdir on a partition root level but don't have a good test subject. So bleh! No clue what xxcopy is.

...wow... attach code butchers end line "\"'s
 
Hey skace,

I ran the script and it works fine right out of the box!

I ended up going with XXCOPY because of the many available advanced switches. (you should look into this)

I'm not entirely sure what "%~2"==" does but I assume its "if file matches.."

I also like the use of the %variable and never thought of it.

I must say, I haven't played with batch commands in years so I'm very rusty...but they sure can do just about anything.

ECHO Thanks for all your effort 😉
 
Hehe cool 🙂. "%~2" is the same as "%2" except the tilde (~) tells it to remove any spaces in the variable. This is good practice because dos is dumb and if your if theres multiple quotes in your if statement, it will break. Have fun!
 
Back
Top