Question Locked

Windows NT Scripting

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi I have been given a script to modify and don't have a clue how. It's a Windows NT Command Script. It's deletes all files that have a specific file extention. I want to modify it to move, (not copy), these files to a location on the server rather than deleting them, (as the below code does.) This script will deployed on all client machines on the LAN. The script is essentially below, with the second line repeated for each file extention.

Thanks,
chuck.

@echo off
for /f "tokens=*" %%j in ('dir /B /s *.mp3') do del /Q "%%j"

4 replies

by fred123456

Its been awhile since I've seen batch scripts but I would asume you would need to modify the do del command to a do move command and add the destination parameter.

You might want to consider re-writing the whole thing with a VB Script.

by dan.cox

I agree with the previous reply. You may want to redo the whole thing in VBScript.
The scripting guys from Microsoft are a great source for writing these types of things.
See this link.

http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar05/hey0317.mspx

This will show you exactly how to script moving files based on extension. It even describes for you what each part of the script is doing so it is easy to understand what is going on. This allows you to easily modify the script for your needs.
Hopefully this helps.

by mr.sweetchuck

Thanks guys, I'll give it a look and see what I can do with it.

This discussion is closed to new replies.