Hey guys- is there any Windows 7 CMD script wizard?!
I have a small need but unsure where to find an answer.
Basically I need a batch file to run in CMD (a scheduled task) that :
from the folder it’s in, copy all the files with a specific extension (picking inside subfolders), created today, and copies them in a network destination (another machine in the same net)
I have to run it every day twice.
Please-- any help? I’m cool with hardware but with scripts I’m lagging behind.
The “running of the script” I know how to do it- that’s the easy part.
Task scheduler takes care of that.
What I need is a simple script that browse the whole folder and subfolders I hardcode into the script itself and extract the files created “today”. Every “today” I run the script.
I have few questions.
In your example…
/d is a date operator,so putting nothing specifies today?
/y suppresses any input from the user, right?
This part…
F:\beta_repo\UnsungBetaPBO\addons
is the source.
I can write \foldername\*.mdl right? and it would search in all its subfolders?
Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.
The /y removes the need for answering yes for overwriting files. For my use case to update a build directory from a svn source this is good enough.
If you really need to copy the last day, you need to somehow get ‘yesterday’ and store it in a variable and feed into xcopy. Not sure how to do that exactly. If you can use powershell instead of cmd, it might be as easy as
Very good- but how do I specify files in subfolders?
Like- in your case Addons has a number of subfolders and I want to extract fro mall of those all the .txt files?
To be fair, once you get into it- and separate it bits by bits, it’s quite simple to read.
That said it can be tricky to write unless you constantly practice.
I don’t understand most Windows code, simply because I don’t take the time to learn, but I do I understand G code and M code machine tool programming fairly well. As you mention about Windows code the G code is fairly easy to read if you break it down by individual code and use it regularly but it is easy to forget otherwise.
G Code:
G code is fairly set across machine types but quite a few of the M code’s are machine dependent and the same code will be used for different functions on different types of machines.