How can i move all files of the same extension into another folder using cmd?
Asked
Active
Viewed 7.6k times
14
user 99572 is fine
- 3,397
- 3
- 30
- 43
Nonso
- 149
- 1
- 1
- 3
-
Possible duplicate of [Move a file to archive folder in cmd using wildcards](https://superuser.com/q/517486/173513) and [How does the Windows RENAME command interpret wildcards?](https://superuser.com/q/475874/173513) – jww Oct 07 '18 at 21:04
2 Answers
19
To copy, can use the copy command with wildcards:
copy *.<extension> <other folder>
And if you to move your files instead: use the move the same way:
move *.<extension> <other folder>
m4573r
- 5,561
- 1
- 25
- 37
-
Why **copy** when user wants to use **move**? `move *.
– Karan Oct 04 '12 at 19:36` works. (Edit: Ah, I see he wrote move/copy in the title, although only move in the question.) -
-
-
-
Here is an example to make things easier: ```d:\test> move *.dll d:\F\ ``` the \ at the end of the folder name is needed otherwise you get an error: `Cannot move multiple files to a single file.` – Dhruv Feb 18 '22 at 19:39
7
Here is an example of moving all files of the jpg format from the C:\ to D:\pictures\ using cmd.
Simply replace jpg with whatever format you wish and then change the to and from locations and you're sorted.
for /r C:\ %f in (*.jpg) do @copy "%f" D:\pictures\
-
2A bit convoluted for such a simple task. Wildcards are a much better answer. – Mike Christiansen Oct 04 '12 at 14:02
-
1I forgot about Wildcards until the other answer was posted sadly, changing my answer to that now would be a bit unfair on the other poster haha. – Oct 04 '12 at 14:05