Wednesday, September 5, 2018

windows - How to move all .txt files in directory structure to another directory via command line?

I have a pretty extensive directory structure:


c:\foo
\foo\1
\foo\1\doc1
\foo\1\doc2
\foo\2
\foo\2\doc1
\foo\2\doc2
...
\foo\10\docX

I want to move (not just copy) all files with .txt extention to a another directory c:\textfiles.


I'd like to do that via command line (the regular one, not Powershell), possibly in a batch file.


I've tried the move command but it only seems to work on files in the current directory. I've also tried xcopy, but it doesn't delete files on the source after the copy is complete.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...