GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Recreate Empty Directory Structure

Non-Recursive Version

If you only want to re-create the top-level, selected directories and not the other directories inside them, use this command:

@dirsonly
@nofilenamequoting
CreateFolder NAME "{destpath$}{file$|noterm}"

That will take the folders selected in the source window/panel and create empty folders with the same names in the destination window/panel.

Recursive Version

If you want to re-create an entire hierarchy of empty directories you can do that as well.

The button below will copy just the selected folders and sub-folders -- but not any of the files -- from the source to the destination.

In other words, it will recreate the selected directory structure in the source by creating matching empty directories in the destination.

The screenshot below shows an example where the original structure on the left has been recreated on the right:

The button requires you to create a simple filter which matches the special [Folders Only] file type. You can do this via Settings -> Preferences as shown below:

Make sure you click OK or Apply in the Preferences window to finish creating the filter.

The button itself is very simple:

Copy FILTER="Folders Only"

Obviously, if you didn't call your filter Folders Only then you should change the name given to the Copy FILTER="xyz" command.

That's it. Now select the directories you wish to recreate and click the button to make it happen.

1 Like

Great! This is very usefull!

Thanks!

avic

I've added the Non-Recursive Version to the top of the original post, for cases where you only want to reproduce the top-level of directories.

Thanks Leo ... from this information I created a new button. (Left click to copy just the upper level folder, Right click to copy all the folders recursively (without the files of course). Works great :slight_smile:

~Paul

Is there a way to include COPYCREATIONTIME=yes?

@dirsonly @nofilenamequoting CreateFolder NAME "{destpath$}{file$|noterm}"

It doesn´t work inserted after CreateFolder or at the end.

Why would you expect an argument from the Copy command to work with the CreateFolder command?

Hmm, that´s true. Maybe, because i used in in a similar way (copying folder structures) . The old command used a copy filter to
copy the folders structures. But i like the top-level only solution, so i´d like to have it combined with the
Copycreationtime feature, if possible.

You could do that by using the recursive version (i.e. the one with the Copy command), adding COPYCREATIONTIME=yes to the Copy command, and changing the filter it uses so that it doesn't go into any subdirectories (by adding a subfolder clause to the filter).

(You can't use the Copy command's arguments with the CreateFolder command, though. That'd never work. Commands only take the arguments they are documented as taking, not all the arguments from other commands.)

Ok, then i will modify my old command to only handle the top directories. Thanks.

Hi, I tried to use your recursive button to create a button that would only copy the files inside.

Basically I download podcasts into folders according to the name of the show, ie:

Z:\radio\All in the mind\whatevershow.mp3 Z:\radio\NPR Radio\anothershow.mp3 etc

It is easy for me to copy these onto my mp3 player, then I want to archive only the podcast mp3 files into folders like:

Z:\radio\Already Put On MP3 Player\All in the mind\whatevershow.mp3 Z:\radio\Already Put On MP3 Player\NPR Radio\anothershow.mp3

, leaving the original folders intact (and empty) like:

Z:\radio\All in the mind\ Z:\radio\NPR Radio\

I tried making a filter called "Files Only", like from your first post (recursive one), using the Type:Match:[Files Only] filter, then making a button with command:

Copy FILTER="Files Only" MOVE

, but it still deletes the source folder, essentially doing just a move of the folder. I want it ideally to leave the source folders intact, just moving the files inside.

Any ideas??

Is it possible to make Recursive Version work with Duplicate option? Not working for me.
I.e. I'd like to duplicate the structure with the different name for the top folder.

Got it. Just Copy As Here ...
Ignore my question, please.