consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

A Coder's Notes

Email :
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull

Get connected and Online Tottington
remote management Makerfield code and design Aspull

Copying *.file from one folder or share to another using FOR - 13/06/2012

Here's another one of those things I've researched, played with and sussed out.  BUT...but but but don't ask me to explain...I'm not sure...

for /R x:\ %q in (*.mdb) do copy "%q" "d:\myfolder%~pq" /y

The "For" command is actually a way of looping through files, folders etc.  If you do "For /?"  you will get a long and comprehensive explanation of the commands available and what they do.

The "/R" bit means that it'll look through a whole folder and subfolders, or in this case a whole drive

"x:\" is the drive I want to plough on through to find my files

"%q" is the variable that sort of becomes the path etc of each loop of "/R"

"in (*.mdb)"  I don't know why or even if I need the brackets, or what the "in" is for, but this is the file I'm searching for, in this case anything that's an MDB

"do", andything after here is applied to the files that are found


Post A Comment

Name Comment
programming services specialist
Valid XHTML 1.0 Transitional