BizTalk Blog by Chris Han

System Design for Enterprise Agility,

  Home  |   Contact  |   Syndication    |   Login
  68 Posts | 9 Stories | 173 Comments | 79 Trackbacks

News

Article Categories

Archives

Post Categories

Image Galleries

BizTalk Bloggers

BizTalk on MSDN

Patterns & Architecture

SharePoint

Wednesday, January 06, 2010 #

It all started with letting iTunes "organize" my video files. For some reason, it decided to create a subfolder for each of my files. Errrrrrr!

Now I'm looking for a way to copy the files in subdirectories back to a single directory. By some online searching and error-trial, here's my solution:

For /r %d "C:\source dir" in (*) do copy "%d" "E:\dest dir"

It's different than a suggested solution I found online something like:

For /r %d "C:\source dir" in (.) do copy %d\*  "E:\dest dir"

However the period character doesn't work for me. According to the explaination, the (.) means all subdirectories, so the %d\* means all files in each subdirectories. But reality is it added a \.\ in the fully path name of the source, the result like this:

copy "C:\source dir\.\video.mp4" "E:\dest dir"

while it should be:

copy "C:\source dir\video.mp4" "E:\dest dir"

Any way, this format works for me, hopefully, same you some time.

For /r %d "C:\source dir" in (*) do copy "%d" "E:\dest dir"

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati