Move files from multiple folders all into parent directory with command prompt
I have multiple .rar files in multiple folders like this:
C:\Docs\Folder1\rarfile1-1.rar
C:\Docs\Folder1\rarfile1-2.rar
C:\Docs\Folder1\rarfile1-3.rar
C:\Docs\Folder2\rarfile2-1.rar
C:\Docs\Folder2\rarfile2-2.rar
C:\Docs\Folder2\rarfile2-3.rar
C:\Docs\Folder3\rarfile3-1.rar
C:\Docs\Folder3\rarfile3-2.rar
C:\Docs\Folder3\rarfile3-3.rar
I want to move all of the .rar files to the parent directory 'C:\Docs'. I have a lot more than 3 folders, so I was thinking of making a batch file or something. What would be the commands to do this?
Thanks
Solution 1:
I've just made a commandline application that does exactly this (plus shows some stats) and searched to see if anybody was trying to do it so I could share it and save someone from having to figure it out.
It was a lot of fun to write. Requires .NET 3.5, works from the commandline, call with -h or no parameter for usage.
MoveFilesUpFromSubfolders
(source code)
Feedback a plus! :)
Oh, and screenshot of how it looks:
Solution 2:
Give this a try:
for /d %f in (docs\*) do (
pushd %f
move .\*.* ..
popd
)
Solution 3:
Well, the answer for your question is very simple. Its not a script but it will do.
I assumed that you are running windows.
- Place youself in C:\Docs directory
- Press F3 (search)
- Search for *.rar
- Press Crtl+A
- Press Ctrl+X
- Close search window and one again go to C:\Dosc in explorer
- Paste cutted files by pressing CTRL+V.
Solution 4:
Suction worked for me on this issue.
Suction is a free, portable app that will help sort out messy folders in no time at all.
Suction works by consolidating parent directories. For example, if your images directory is full of unnecessary folders, drag the folder into the Suction interface, and it will do away with the folders, leaving you just with the files. This is also useful for people who download a lot of stuff.