Move files from subfolder to parent folder

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kluv
Posts: 32
Joined: 02 Mar 2011 13:23

Move files from subfolder to parent folder

Post by kluv »

HI All,

Is there a way to select multiple subfolders and have the content inside moved to the parent folder?

Thank you for your help.

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Move files from subfolder to parent folder

Post by highend »

Configuration | General | Menus, Mouse, Safety | Context Menus | File List...
[x] Flatten Folder [folders only]
One of my scripts helped you out? Please donate via Paypal

kluv
Posts: 32
Joined: 02 Mar 2011 13:23

Re: Move files from subfolder to parent folder

Post by kluv »

Thanks but this isn't it. I needed the files inside the subfolder moved to the parent folder. Unless, I did something wrong or missed a step "Flatten Folder" only moves the folders.

Appreciate the quick reply!!

admin
Site Admin
Posts: 64854
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Move files from subfolder to parent folder

Post by admin »

No, such a command does not exist ATM. Would be something like "extract here" for folders (instead of archives).

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Move files from subfolder to parent folder

Post by highend »

Or simply be scripted...

Code: Select all

    setting "BackgroundFileOps", 0;
    foreach($selected, <get SelectedItemsPathNames |>, , "e") {
        if (exists($selected) != 2) { continue; }
        $files = quicksearch("/f", $selected, "|", "s");
        moveto , $files, , 1, 0, 4;
    }
The empty sub directories aren't deleted by the script... Should they?
One of my scripts helped you out? Please donate via Paypal

haaranoos
Posts: 15
Joined: 29 Apr 2017 11:53

Re: Move files from subfolder to parent folder

Post by haaranoos »

Hello highend.
the script doesn't work for me.

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Move files from subfolder to parent folder

Post by highend »

And you did what exactly? How many folders where selected, where there any files inside them?
One of my scripts helped you out? Please donate via Paypal

kubbie
Posts: 5
Joined: 21 Aug 2021 19:24

Re: Move files from subfolder to parent folder

Post by kubbie »

highend wrote: 09 Sep 2019 14:07 Or simply be scripted...

Code: Select all

    setting "BackgroundFileOps", 0;
    foreach($selected, <get SelectedItemsPathNames |>, , "e") {
        if (exists($selected) != 2) { continue; }
        $files = quicksearch("/f", $selected, "|", "s");
        moveto , $files, , 1, 0, 4;
    }
The empty sub directories aren't deleted by the script... Should they?
Is there a way to tag multiple dirs to move as this only does 1 folder?

highend
Posts: 14566
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Move files from subfolder to parent folder

Post by highend »

The script processes multiple selected folders as well, as long as they have the same parent dir
One of my scripts helped you out? Please donate via Paypal

kubbie
Posts: 5
Joined: 21 Aug 2021 19:24

Re: Move files from subfolder to parent folder

Post by kubbie »

highend wrote: 18 Oct 2025 15:59 The script processes multiple selected folders as well, as long as they have the same parent dir
I'm not sure what I'm doing wrong then cause if I selected 2 or more folders it doesn't move anything but if I select 1 folder then it moves it correctly. Can you show me the light?

Here is my folder structure:

d:\temp\
d:\temp\test1\move1.txt
d:\temp\test2\move2.txt
d:\temp\test3\move3.txt

I'm trying to move all 3 of those files to d:\temp

Post Reply