Solved How to copy directory structure

Clairvaux

New member
Pro User
VIP
Local time
3:53 PM
Messages
247
Hello,

I'm just trying to copy a hierarchy of folders without the files in it. I'm aghast at the way this seems so hard to achieve. I've got a slew of file managers, and none seems to do that out of the box.

I was directed to use xcopy. I can't make it work.

My folder structure is the following :

Folder 1
Folder 2

Then each folder has a few nested levels. That's all.

I'm typing the following command in cmd :

Code:
xcopy /t /e "F:" "D:\...\Dummy folder for testing purposes"

Then I get a silly question on the lines of is this a file (F) or directory (D), I answer D, and I get an answer "Insufficient memory". WTF ?

Or, in some other sequence of events I cannot reconstitute now, I do get a result, but only the Folder 1 structure gets copied. And not even that : it's only the folders below Folder 1 which get copied, Folder 1 one does not.

Should I write F:, or F:\ ?

Or is there an easier method than this prehistoric xcopy rigmarole ?

Thanks in advance for your help.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom build
OS
Windows 7 Home Premium 64-bit (OEM)
CPU
AMD Athlon II X4 640 (3 GHz, 4 cores)
Motherboard
Asus M4A 89 GTD Pro/USB3
Memory
Patriot 16Gb DDR3 1600 (2 kits of 2)
Graphics Card(s)
ATI Radeon HD 4290 (integrated)
Sound Card
AMD + Realtek HD Audio (integrated)
Monitor(s) Displays
Hewlett-Packard ZR2440w (24")
Screen Resolution
1920 x 1200
Hard Drives
Internal : Samsung SSD 860 EVO 250 Gb (system), Seagate Barrcuda 1 Tb (data), Western Digital Caviar Blue 500 Gb (archives).
External (USB) : 2 x 1 Tb 2,5" Seagate Barracuda (backups).
PSU
Corsair VX 450 W
Case
Antec Solo
Cooling
Cooler Master Hyper 212 Plus, 2 Nexus Real Silent Case fans
Keyboard
Cherry KC 1000
Mouse
Logitech M 90
Internet Speed
Fiber, 300 Mbit/s down, 200 Mbit/s up
Antivirus
Microsoft Security Essentials
Browser
Vivaldi, Tor
Other Info
BIOS Date: 07/18/11 Ver: 08.00.15.
Modem-router : provided by ISP
robocopy "D:\Dummy folder for testing purposes" "E:\copy of Dummy folders" /e /mir /np
 

My Computer

Computer type
PC/Desktop
OS
w7x64
CPU
g530
Motherboard
h61m-s2pv
Memory
4gb ddr3
Graphics Card(s)
int.
Antivirus
none
Browser
opera
I'm afraid this does not work. It attempts to write the files, and fortunately fails, since there's not enough space.

I read the help of Robocopy, and did not find any indication that those switches would copy only the folders, not the files.

Also, I don't have one top folder, I have two, and this seems to be a problem.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom build
OS
Windows 7 Home Premium 64-bit (OEM)
CPU
AMD Athlon II X4 640 (3 GHz, 4 cores)
Motherboard
Asus M4A 89 GTD Pro/USB3
Memory
Patriot 16Gb DDR3 1600 (2 kits of 2)
Graphics Card(s)
ATI Radeon HD 4290 (integrated)
Sound Card
AMD + Realtek HD Audio (integrated)
Monitor(s) Displays
Hewlett-Packard ZR2440w (24")
Screen Resolution
1920 x 1200
Hard Drives
Internal : Samsung SSD 860 EVO 250 Gb (system), Seagate Barrcuda 1 Tb (data), Western Digital Caviar Blue 500 Gb (archives).
External (USB) : 2 x 1 Tb 2,5" Seagate Barracuda (backups).
PSU
Corsair VX 450 W
Case
Antec Solo
Cooling
Cooler Master Hyper 212 Plus, 2 Nexus Real Silent Case fans
Keyboard
Cherry KC 1000
Mouse
Logitech M 90
Internet Speed
Fiber, 300 Mbit/s down, 200 Mbit/s up
Antivirus
Microsoft Security Essentials
Browser
Vivaldi, Tor
Other Info
BIOS Date: 07/18/11 Ver: 08.00.15.
Modem-router : provided by ISP
Are you literally entering "D:\...\Dummy folder for testing purposes"? I can't imagine the three dots is going to work.

Create a directory (e.g., "D:\dummy"), then use that in your command, ala:
Code:
xcopy  /t  /e  f:\  d:\dummy

The difference between f: and f:\ is that the former copies from wherever the f: volume's "current directory" is, while the latter copies from the root of the f: volume.

At the command prompt, you can enter "f:" to see where the current directory is. For example, if you type the following:
Code:
f:
cd  f:\folder1\folder2
then f:'s "curdir" will be f:\folder1\folder2, and your xcopy command will only copy the directory structure below folder2. If that's what you want, fine. But if you want everything from the root directory, use f:\ instead of f:.

Note that if f:'s curdir is actually the root directory, then both variations will produce the same result.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Optiplex 7050
OS
Windows 7/8.1/10 multiboot
CPU
Intel Core i7-7700
Motherboard
Dell, Intel Q270 chipset
Memory
48GB (2x16GB Crucial DDR4-3200 + 2x8GB Hynix DDR4-2400)
Graphics Card(s)
Intel HD630 + AMD Radeon R7 450 PCIe
Monitor(s) Displays
Asus VC279 (27")
Screen Resolution
1920x1080
Hard Drives
Toshiba M.2 NVMe (256GB),
Samsung 960 Evo (500GB),
WD Red Plus 80EFBX (8TB)
XCOPY *.* D: /s /e /t I thought would do the trick for you.

Switches used:
/s copy subdirectories
/e copy all subdirectories even if they are empty.
/t copy the subdirectory tree only, not the files.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 x64, Vista x64, 8.1 smartphone
CPU
Intel E8400 65W 64-bit
Motherboard
Gigabyte EP45-UD3LR
Memory
DDR2 2 x 2GB, 1GB x 2
Graphics Card(s)
XFX Radeon HD5750
Sound Card
AMD High Definition Audio; Realtek High Definition Audio
Monitor(s) Displays
iiyama prolite X2377HDS
Screen Resolution
1920 x 1080
Hard Drives
500GB 7200 rpm Seagate ST3500413AS 16MB, 500GB 5400 rpm Toshiba MQ02ABF050H 32MB, 200GB 7200 rpm Seagate ST3200820AS 8MB, 2TB 7200 rpm Western Digital WD20EZRX 64MB
PSU
Enermax Liberty Modular
Case
Antec P193 Midi Tower
Keyboard
Mionix ZIBAL 60
Mouse
Razer USB 2.0 Diamondback Mouse or Huion Graphics Tablet
Browser
Internet Explorer, Lunascape, Firefox, Opera, Avast Safezone
Thank you all for your help. None of the command-line tricks worked, and I know why now.

The only thing that remotely worked -- but then stopped short of completing the task, was this :

Code:
xcopy F:\ D:\Destination_folder /t /e

It copied part of the file structure, then stopped with the error message of "Insufficient memory".

That's exactly the result I had reached repeatedly before.

I have now learned that this error message is an odious bug of xcopy, which has never been corrected in decades. It does not detect insufficient memory (of course), but file or folder names which are too long for xcopy to handle. It bears mentioning that Windows has no trouble handling those folder names.

I found two solutions. Both are of the non-prehistoric sort, meaning they are actual programs, not stupid command lines.

The first one is a completely abandoned piece of freeware, which is mentioned in that Super User thread. It's so abandoned, it's only available on Archive.org. It's called 47 Folders. This intelligent little gem looks unfortunately unfinished, but it only copies folder structures, and it does that all right.

The other one is a whole substitute for Windows Explorer, the very smart and interesting XYplorer. It has (shall I say of course ?) an embedded command to copy folder structures. Either copy the top folder (or folders), use Paste Special in the destination folder, then Paste Folder Structure (yes ! this is actually a command !). Or, drag and drop the top folder (or folders) to their destination, and choose Create Branches Here.

XYplorer has a free version, already quite powerful, but unfortunately, development for it has stopped in 2016. The current version is paying only, and it comes at the not-unjustified price of $ 40. Unfortunately, this will only buy you one year of upgrades. The only alternative to it is the frankly too expensive life license at $ 80, which is a shame, because fast updates are one of the advantages of XYplorer.

The program was much cheaper a few years ago (not to mention the free version).

My daily file explorer is the Light, paying version of Directory Opus (another extremely powerful alternative to Windows Explorer), and even the Pro version needs some programming to be able to just copy folder structures, for God's sake (the Light version can't do it at all).

How come there are not a zillion of embedded and not embedded options to do that in a simple and free way ? This is a basic need, isn't it ?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom build
OS
Windows 7 Home Premium 64-bit (OEM)
CPU
AMD Athlon II X4 640 (3 GHz, 4 cores)
Motherboard
Asus M4A 89 GTD Pro/USB3
Memory
Patriot 16Gb DDR3 1600 (2 kits of 2)
Graphics Card(s)
ATI Radeon HD 4290 (integrated)
Sound Card
AMD + Realtek HD Audio (integrated)
Monitor(s) Displays
Hewlett-Packard ZR2440w (24")
Screen Resolution
1920 x 1200
Hard Drives
Internal : Samsung SSD 860 EVO 250 Gb (system), Seagate Barrcuda 1 Tb (data), Western Digital Caviar Blue 500 Gb (archives).
External (USB) : 2 x 1 Tb 2,5" Seagate Barracuda (backups).
PSU
Corsair VX 450 W
Case
Antec Solo
Cooling
Cooler Master Hyper 212 Plus, 2 Nexus Real Silent Case fans
Keyboard
Cherry KC 1000
Mouse
Logitech M 90
Internet Speed
Fiber, 300 Mbit/s down, 200 Mbit/s up
Antivirus
Microsoft Security Essentials
Browser
Vivaldi, Tor
Other Info
BIOS Date: 07/18/11 Ver: 08.00.15.
Modem-router : provided by ISP
Thank you all for your help. None of the command-line tricks worked, and I know why now.

The only thing that remotely worked -- but then stopped short of completing the task, was this :

Code:
xcopy F:\ D:\Destination_folder /t /e

It copied part of the file structure, then stopped with the error message of "Insufficient memory".

That's exactly the result I had reached repeatedly before.

I have now learned that this error message is an odious bug of xcopy, which has never been corrected in decades. It does not detect insufficient memory (of course), but file or folder names which are too long for xcopy to handle. It bears mentioning that Windows has no trouble handling those folder names.

...

How come there are not a zillion of embedded and not embedded options to do that in a simple and free way ? This is a basic need, isn't it ?

Sorry I did not understand that your question was about "insufficient memory" error. Anyhow, you seem to have understood the reason why this error occurs. The problem is not due to XCOPY. The problem is due to Windows file lengths being shorter than the NTFS file system file lenghts - that is how your disk drive accepts long file lenghts, but Windows stubbornly refuses to obey. You can bypass the issue by renaming files and folders, so they have a shorter number of characters. It is possible also to circumvent the restriction in Windows 10. If you have Windows 10, you can connect your disk drives to that Operating System, and follow this tutorial :ar: Enable or Disable Win32 Long Paths in Windows 10 | Tutorials
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 x64, Vista x64, 8.1 smartphone
CPU
Intel E8400 65W 64-bit
Motherboard
Gigabyte EP45-UD3LR
Memory
DDR2 2 x 2GB, 1GB x 2
Graphics Card(s)
XFX Radeon HD5750
Sound Card
AMD High Definition Audio; Realtek High Definition Audio
Monitor(s) Displays
iiyama prolite X2377HDS
Screen Resolution
1920 x 1080
Hard Drives
500GB 7200 rpm Seagate ST3500413AS 16MB, 500GB 5400 rpm Toshiba MQ02ABF050H 32MB, 200GB 7200 rpm Seagate ST3200820AS 8MB, 2TB 7200 rpm Western Digital WD20EZRX 64MB
PSU
Enermax Liberty Modular
Case
Antec P193 Midi Tower
Keyboard
Mionix ZIBAL 60
Mouse
Razer USB 2.0 Diamondback Mouse or Huion Graphics Tablet
Browser
Internet Explorer, Lunascape, Firefox, Opera, Avast Safezone
Sorry I did not understand that your question was about "insufficient memory" error. Anyhow, you seem to have understood the reason why this error occurs. The problem is not due to XCOPY. The problem is due to Windows file lengths being shorter than the NTFS file system file lenghts - that is how your disk drive accepts long file lenghts, but Windows stubbornly refuses to obey. You can bypass the issue by renaming files and folders, so they have a shorter number of characters. It is possible also to circumvent the restriction in Windows 10. If you have Windows 10, you can connect your disk drives to that Operating System, and follow this tutorial :ar: Enable or Disable Win32 Long Paths in Windows 10 | Tutorials

You are welcome. If the problem is not due to xcopy, why is it that XYplorer manages it, or Macrium Reflect manages it (this is my backup disk and backup folder hierarchy), or that Robocopy manages it (at least according to advice given in various forums to solve precisely that problem) ? Or, indeed, that Windows Explorer manages it, since that's what I use concurrently with Directory Opus, and it was perfectly able to read and open those folders after my test copy with XYplorer ?

I don't plan to downgrade to Windows 10, and I cannot change the folder names. My backup routine has been running smoothly for years, and the least I change it, the more secure I am.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom build
OS
Windows 7 Home Premium 64-bit (OEM)
CPU
AMD Athlon II X4 640 (3 GHz, 4 cores)
Motherboard
Asus M4A 89 GTD Pro/USB3
Memory
Patriot 16Gb DDR3 1600 (2 kits of 2)
Graphics Card(s)
ATI Radeon HD 4290 (integrated)
Sound Card
AMD + Realtek HD Audio (integrated)
Monitor(s) Displays
Hewlett-Packard ZR2440w (24")
Screen Resolution
1920 x 1200
Hard Drives
Internal : Samsung SSD 860 EVO 250 Gb (system), Seagate Barrcuda 1 Tb (data), Western Digital Caviar Blue 500 Gb (archives).
External (USB) : 2 x 1 Tb 2,5" Seagate Barracuda (backups).
PSU
Corsair VX 450 W
Case
Antec Solo
Cooling
Cooler Master Hyper 212 Plus, 2 Nexus Real Silent Case fans
Keyboard
Cherry KC 1000
Mouse
Logitech M 90
Internet Speed
Fiber, 300 Mbit/s down, 200 Mbit/s up
Antivirus
Microsoft Security Essentials
Browser
Vivaldi, Tor
Other Info
BIOS Date: 07/18/11 Ver: 08.00.15.
Modem-router : provided by ISP
You are welcome. If the problem is not due to xcopy, why is it that XYplorer manages it, or Macrium Reflect manages it (this is my backup disk and backup folder hierarchy), or that Robocopy manages it (at least according to advice given in various forums to solve precisely that problem) ? Or, indeed, that Windows Explorer manages it,

Because all these programs are directly interacting with the NTFS file sub-system. Windows Explorer is great for viewing long file names, but it will flag an error if you go to try move files or directories that are longer than the maximum file length. I therefore expect that the other example programs will encounter similar message, should you use them to move or copy long file names.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 x64, Vista x64, 8.1 smartphone
CPU
Intel E8400 65W 64-bit
Motherboard
Gigabyte EP45-UD3LR
Memory
DDR2 2 x 2GB, 1GB x 2
Graphics Card(s)
XFX Radeon HD5750
Sound Card
AMD High Definition Audio; Realtek High Definition Audio
Monitor(s) Displays
iiyama prolite X2377HDS
Screen Resolution
1920 x 1080
Hard Drives
500GB 7200 rpm Seagate ST3500413AS 16MB, 500GB 5400 rpm Toshiba MQ02ABF050H 32MB, 200GB 7200 rpm Seagate ST3200820AS 8MB, 2TB 7200 rpm Western Digital WD20EZRX 64MB
PSU
Enermax Liberty Modular
Case
Antec P193 Midi Tower
Keyboard
Mionix ZIBAL 60
Mouse
Razer USB 2.0 Diamondback Mouse or Huion Graphics Tablet
Browser
Internet Explorer, Lunascape, Firefox, Opera, Avast Safezone
Thanks for the in depth response. If someone else comes along with the same issue that'll help them on their way. I thought maybe Terracopy could do it, but it just copies files and folders. There's no files and folder names copy option. If you run into a long file name issue in the future when it comes time to move or copy a file or folder, you might be able to use Fastcopy and it has the ability to delete long path names. The aforementioned Terracopy might be able to copy and paste long path names as well. Download FastCopy - MajorGeeks

Are you native French? Your writing is pretty decent if you are in fact native French and your native language is French. I have to laugh because even some Americans can't write for crap.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Back
Top