I'm sorry for asking this, I know it must have been asked a hundred times before. I tried the search and a google site search, and couldn't come up with anything similar.
What I want is:
To have a selection of folders
Run a script that moves ALL files in all subfolders to the current folder.
I want all those picture-files to be moved to the CurrentFolder
Also if all folders/subfolders inside of there could be deleted once the files are moved, that would be sweet.
set flatview=MixedNoFolders
select *(jpg|png|gif|bmp)
copy here
It works as far as copying the files go.
It asks me if I want to recreate the folder structure or place the files in the same folder.
Is there a way to silently/automatically select the Same Folder?
Hmm, what would I write to select only folders and delete them?
My little DirFlatten tool might be useful. As well as moving the files it'll prefix each folder's files with a number so they stay grouped together (which may be good or bad, depending on what you're trying to do).
Thanks for the tip Jon! That worked flawlessly.
The DirFlatten tool also worked perfectly for what I wanted, but as it worked with the built-in tools it makes no sense in using a separate application. I will use it at work where I don't have my DOpus though
Here's the "final" version of the script for anyone that might search for the same solution on how to move all files from a subfolder:
SET flatview=MixedNoFolders
SELECT ALLFILES
COPY MOVE HERE FLATVIEWCOPY=single
SET flatview=off
SELECT ALLDIRS
I also made it select all directories to make them easier to delete afterwards, but I didn't want to delete the folders themselves (if an error were to occur)
Hi @Jon or @Leo, I need a button that moves all files from sub-folders to the current folder.
I tried creating a button with @MNeMiC's suggested code:
SET flatview=MixedNoFolders
SELECT ALLFILES
COPY MOVE HERE FLATVIEWCOPY=single
SET flatview=off
SELECT ALLDIRS
Unfortunately, it doesn't seem to work properly (or as I expected it to).
After pressing the button, it simply displays all files in both the current folder...and sub-folders. Additionally it displays a renaming prompt on every file listed.
Looking at the date of the last post, it was 13 years ago. So maybe something changed that's causing this unexpected behavior.
I would appreciate any updated advice to accomplish such a task.
Using the Select command to change which files another command uses is usually not the best approach. (It’s for changing what’s selected in the UI, while there are more direct ways to change which things commands work on.)
I would use scripting to build a list of files below the current folder and pass that to the Copy command. Then the button also doesn’t have to turn Flat View on and off, which can be time consuming and would be annoying if you wanted it to stay on.
(The default script includes an example of how to enumerate the files below a folder.)
Thanks @WKen! That code you posted (below the link) solves my problem.
At first I thought it glitched out when it immediately asked me to delete the sub-folders. But then I noticed the files were in the main-folder, right where I wanted them. It works so fast, it was initially surprising!
Won't that move things up one level, rather than flatten everything to the top level? There are better ways to do that, if so, and I am not sure that command is safe if you have nested folders with the same names like C:\...\Foo\Foo
I've been using it over the last hour, and it's worked without problems. I've been able to test both single and multi layered subfolders. After pressing the button, the files always appear in my active folder. And I've been double checking to make sure every file is moved correctly.
But just to be sure...I also tested your warning about identically named subfolders. And it worked in that scenario as well.
Of course, I will keep your warning in mind and use this feature sparingly. I'm not looking to do anything complicated - and in my use case, I'm double checking to make sure all files are accounted for.