Move all files inside folders to parent directory


  1. Posts : 2
    Windows 10
       #1

    Move all files inside folders to parent directory


    Hello,

    First of all, I would like to apologize if this topic is not in the correct forum.

    My problem is the following:
    I have a folder (let's call it BASKET), inside that folder I have many other folders (for the sake of the example, I will name for example 3 folders - banana, apple, and cucumber). These 3 folders (in my case its many many folders) have files in them. I would like to move those files (from banana, cucumber, and apple) to the BASKET folder. The folders are so many, it's tedious to go in each one and move the files back one by one.

    Can anyone help me out on how to achieve that in a geeky way? Some sort of batch file? A windows trick that I have not heard of?

    Regards,
    tonykaram1993
      My Computer


  2. Posts : 287
    win 10 home
       #2

    What you need is a file manager that can 'search' recursively from the context menu.

    I work with, 99% of the time, XnView (Classic). I have done what you want to do, by right-clicking the parent folder in the navigation panel, and selecting 'show all files' recursive search. The file manager/browser will then allow you to 'browse', and list the entire contents of the parent folder and all of its sub- and sub-subfolders. Ctrl-A selects all and you just slide/drag to the parent folder.

    The problem you may run into is duplicate filenames that will end up in the same parent folder. Map out a strategy beforehand.
      My Computer


  3. Posts : 2
    Windows 10
    Thread Starter
       #3

    pyramid10 said:
    What you need is a file manager that can 'search' recursively from the context menu.

    I work with, 99% of the time, XnView (Classic). I have done what you want to do, by right-clicking the parent folder in the navigation panel, and selecting 'show all files' recursive search. The file manager/browser will then allow you to 'browse', and list the entire contents of the parent folder and all of its sub- and sub-subfolders. Ctrl-A selects all and you just slide/drag to the parent folder.

    The problem you may run into is duplicate filenames that will end up in the same parent folder. Map out a strategy beforehand.
    You just gave me an idea and it worked. I went to the BASKET folder and searched for the extension of the files (in my case its .mp3) then cut and pasted all the files where I wanted. Obviously this won't work for multiple extension (maybe you can search for .* ?). But thanks anyway since you gave me that idea.

    Peace.
      My Computer


  4. Posts : 5,478
    2004
       #4

    If you don't have nested folders something like this would do it - otherwise you would have to keep repeating it.

    Assuming your folder "Basket" is on your desktop...

    Code:
    cd %userprofile%\Desktop\Basket
    for /d %i in (*) do move "%i\*" %userprofile%\Desktop\Basket
    What it is doing is changing the working directory to basket then for each directory inside it (that is the /d flag) move everything it contains to the path defined basket again).

    It will prompt you if you there are duplicate names.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:26.
Find Us




Windows 10 Forums