Is there a way to copy directory structure?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Is there a way to copy directory structure?

Post by *Andante »

I would like to duplicate the directory structure from one branch to another. I don't want to copy any files, just the structure itself. Can TC do this?
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

Sure, it's a little bit tricky, but easy:

Just select the folders you want to copy and enter at "Only files of this type" a name which does not exist at all (e.g. asdfasdf)

This will copy folders without any file :idea:
#5767 Personal license
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Post by *Andante »

Omg, that's FABULOUS!!! I've been using TC for more than two decades, and I never knew that trick before. Thank you so much, Wizard!

What other secret tricks do you know? Would love to learn from you. :-)
palos
New Member
New Member
Posts: 1
Joined: 2019-03-19, 10:02 UTC

Re: Is there a way to copy directory structure?

Post by *palos »

The (TC) standard way is pretty straigthforward, although it may seem tricky: 1. Select the top level directories to be copied - 2. Click Copy/press F5 - 3. Click on the button having '+' label next to the type selector listbox (bottom) (or select a previously created directory template name from the listbox and continue on step 11) - 4. Enter asterisk (*) into the 'Search for' textbox - 5. Click on/select the Advanced tab - 6. Check 'Attributes' checkbox - 7. Check 'Directories' checkbox - 8. Select 'Save' button - 9. Enter 'DirsOnly' (or any other label at your will) into the template name textbox - 10. Click OK - 11. Click OK ... wait until done, normally pretty soon depending on the direcory tree size.

That's all. Worth to NOTE that the steps 4-10 can be done separately creating a template for directories only, which can be useful in other cases also. In such cases just that template name needs to be selected for the manipulation.



[MTAG]
pipsi
Junior Member
Junior Member
Posts: 2
Joined: 2019-03-19, 20:57 UTC

Re: Is there a way to copy directory structure?

Post by *pipsi »

Andante:

Select dirs to copy; Hit F5; In "files of this type", write

Code: Select all

|*.*
Hit OK. Done.
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: Is there a way to copy directory structure?

Post by *hi5 »

Just type .. in the "file types" (.. = folder 'file type')
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Is there a way to copy directory structure?

Post by *MVV »

hi5 wrote: 2019-03-19, 22:13 UTC(.. = folder 'file type')
No, ".." is not a folder file type, ".." is just a reserved file system, so it causes TC to skip all files (just like as sqa_wizard's way does and which is usually used by me), but folders can't be skipped so only folders are copied.
pipsi
Junior Member
Junior Member
Posts: 2
Joined: 2019-03-19, 20:57 UTC

Re: Is there a way to copy directory structure?

Post by *pipsi »

Just type .. in the "file types"
Elegant!
klappa
Junior Member
Junior Member
Posts: 75
Joined: 2008-07-23, 12:27 UTC

Re: Is there a way to copy directory structure?

Post by *klappa »

palos wrote: 2019-03-19, 10:37 UTC The (TC) standard way is pretty straigthforward, although it may seem tricky: 1. Select the top level directories to be copied - 2. Click Copy/press F5 - 3. Click on the button having '+' label next to the type selector listbox (bottom) (or select a previously created directory template name from the listbox and continue on step 11) - 4. Enter asterisk (*) into the 'Search for' textbox - 5. Click on/select the Advanced tab - 6. Check 'Attributes' checkbox - 7. Check 'Directories' checkbox - 8. Select 'Save' button - 9. Enter 'DirsOnly' (or any other label at your will) into the template name textbox - 10. Click OK - 11. Click OK ... wait until done, normally pretty soon depending on the direcory tree size.

That's all. Worth to NOTE that the steps 4-10 can be done separately creating a template for directories only, which can be useful in other cases also. In such cases just that template name needs to be selected for the manipulation.



[MTAG]
It doesn't work for me. It copies all the contents. I just want to copy the top structure dirs no sub structures.
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Is there a way to copy directory structure?

Post by *Stefan2 »

klappa wrote: 2020-05-26, 10:40 UTC
palos wrote: 2019-03-19, 10:37 UTC
It doesn't work for me. It copies all the contents. I just want to copy the top structure dirs no sub structures.


For to copy the empty folder structure only, without any files, use
sqa_wizard wrote: 2018-03-14, 23:03 UTC Just select the folders you want to copy and enter at "Only files of this type" a name which does not exist at all (e.g. asdfasdf)
This will copy folders without any file :idea:


For to copy the empty TOPLEVEL folder structure only, without any files, use

- a script (TC will provide parameters for selected folders and target folder)

- or an WCX "packer"-plugin
like the "DirCopy" plugin from François GANNIER which can do what you want: copying one or more top level folders only.
https://totalcmd.net/plugring/dircopy.html


How to use an WCX "packer"-plugin
- download the plugin
- with TC locate the archive and double click on it
- for WCX-plugin assign during the setup a "file type" (2 to 10 chars), here f.ex.: "DirCopy"
- use an WCX-plugin by pressing Alt+F5 to open the "Files > Pack..." dialog.
- select the wanted plugin (your chosen "file type") from the Packer-drop-down combobox above the [Configure]-button.
- some plugin allow configuration via the [Configure]-button or its settings ini file, see the read.me file of the plugin.




 
klappa
Junior Member
Junior Member
Posts: 75
Joined: 2008-07-23, 12:27 UTC

Re: Is there a way to copy directory structure?

Post by *klappa »

Stefan2 wrote: 2020-05-26, 14:11 UTC
klappa wrote: 2020-05-26, 10:40 UTC
palos wrote: 2019-03-19, 10:37 UTC
It doesn't work for me. It copies all the contents. I just want to copy the top structure dirs no sub structures.
. . . 
Thank you! How do I compile a script with help of TC parameters? I tried to read the instructions on how to install the plugin but I don't know how use it.
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

PowerShell: Is there a way to copy directory structure?

Post by *Stefan2 »

klappa wrote: 2020-05-26, 19:12 UTC
Stefan2 wrote: 2020-05-26, 14:11 UTC
klappa wrote: 2020-05-26, 10:40 UTC

It doesn't work for me. It copies all the contents. I just want to copy the top structure dirs no sub structures.
. . . 
Thank you! How do I compile a script with help of TC parameters?
I tried to read the instructions on how to install the plugin but I don't know how use it.



TC provide parameter for selected files or folders\

For example:
"%L" : Create a list file in the TEMP directory with the names of the selected files and directories.
"%T" : Path in Target panel

For parameters see > Help "Operation > Menus > Menu: Configuration > Change Button Bar > Configuration - Change button bar".

With such parameters you can feed your script (MS-Dos Batch/PowerShell/VBS/AutoHotkey/...)


For your issue: Create selected folders in target panel

Code: Select all

Command: cmd /K
Parameters: FOR /F "tokens=*" %%x IN (' type "%F" ') DO @echo MD "%T%%x"
Start path: 
Icon file: WCMICONS.DLL
Tooltip: Script to do smtg with each file from "%F"
Select some files or folder, press the button, in other panel new directories are created with name from selected files or folders.

NOTE: To enable the above command for real work, change "cmd /k" to "cmd /c" and remove the command "ECHO".



Note: Batch works best with basic english ansi/ascii letters only. For umlauts or unicode better use VBS or PoSh.
Or try with another code page like "Parameters: chcp 1252 & FOR /F . . . ...." for windows CP or chcp 65001 for UTF-8 CP

Code: Select all

Command: PowerShell -NoExit -NoProfile
Parameters: Get-Content '%F' | ForEach{ New-Item -Path '%T' -Name "$_" -ItemType "directory" }
Start path: 
Icon file: PowerShell --or-- WCMICONS.DLL
Tooltip: Script to do smtg with each file from "%F"




Other people also read this
viewtopic.php?f=3&t=52425


 
Post Reply