Think you’re a Windows expert? Here’s a stumper for you. See if you can guess the answer.
On my primary hard disk, I have a folder filled with 430 digital image files in JPEG format. Collectively, they occupy a little under 300MB of disk space.
I want to copy those files from one machine to another using a 1GB USB flash drive I have hanging around. The flash drive is formatted and completely empty.
I open Windows Explorer, select all the image files, and drag them onto the flash drive icon. Windows begins copying the files to the portable drive, but about a third of the way through, the copying process stops with a cryptic error message containing the code 0x80070052: “The directory or file cannot be created.”
What’s the problem, and how can I fix it?
First one to get the correct answer wins a signed copy of Windows XP Inside Out, Second Edition.
Update: We have a winner. See the comments for the discussion. Here’s a more detailed explanation:
The problem is that the flash drive, like many USB devices, was formatted using the FAT16 file system. Most Windows users haven’t had to deal with this disk format in years. FAT32 was introduced in 1996, and Windows XP has supported NTFS as the default file system since its introduction in 2001.
So what’s the problem? FAT16 volumes impose a strict limit of 512 entries in the root directory (you can have as many as you want in subfolders). A KB article, Errors Creating Files or Folders in the Root Directory, explains:
This problem occurs when all 512 root directory entries have been used. This problem can also occur with fewer than 512 files and folders in the root directory because Windows 95 uses additional directory entries to store long file names.
A table at the end of this article explains that long filenames typically use four directory entries, and my digital image files were definitely using long names. So at 4 directory entries per file and 512 entries total, I was running out of room to store filenames when I hit 128 files.
The solution was to create a subfolder on the flash drive and copy the files there instead. As soon as I did that, all was well.
I already have a signed copy of your book, but I’ll guess anyway. π
That error message means that you don’t have enough space on your flash drive. Before Windows Explorer can copy the files to your flash drive, it needs to uncompress the jpg files. When this happens, they get very large — much more than 1 GB in your particular example. For example, observe what happens when you open a .jpg file and then save it as a .tif file (no compression). The saved file will be MUCH larger than the original jpg file.
I am further guessing that you can solve the problem by first compressing the 430 jpg files into a .zip file and then copying the .zip file to the flash drive.
My guess is that the root directory of the flash drive’s file system (and any other root directory) can only hold 224 files. Even if that’s right, I’m not sure if I win because it ain’t like I knew that off the top of my head. Google wins!
Well, he did say that he got the error message a third of the way through the copy operation. If there are 430 files and it can hold only 224, the error would have happened barely more than halfway through. But maybe I am overthinking this. Hmm…I hate brainteasers.
Ken, that’s a very creative theory, but nope. That’s not it.
Carl, you need to Google just a little more.
Oh, and I said “about a third of the way through.”
Okay, let me try this. Reformat the flash drive from FAT to NTFS. Then try it again.
And if THAT doesn’t work, first create a folder on your flash drive and then copy the files into that folder.
It seems that the flash disk is FAT formatted and the FAT table cannot cope. Maybe formatting using NTFS with smaller cluster size will solve the problem.
Since you never specified if you copied ANY of the files over at all, let’s try the SIMPLEST solution first π
Do you have some sort of ‘read only’ option set on your USB drive which prevents XP from writing to it in the first place?
Nice guesses, everyone, but there’s a simple explanation and a simple answer that need to be expressed first.
Evilkat, yes, I was able to copy roughly a third of the files before I got that error message.
Reformat flash drive from fat16 to fat32
Hmmm. I wonder if windows caches the files its copies to the Flash drive some place before writing it directly to the drive? If it does, and the cache runs out of space due to some time out on the flash drive then that could cause an unable to create_file perhaps? Although I suppose that should be an out of space error.
The other thing to look at is since it’s always failing a 3rd of the way through the copy process, it might be worthwhile trying to figure out which file it’s trying to copy when it’s failing.
Finally, maybe the USB drive is corrupted? Can you copy any other files over to it? I mean maybe it has a bad sector or something π Wait, does Flash based storage even HAVE sectors? That’s what used to happen with bad floppies back in the day.
Does your usb port work properly?
And are the drivers for USB properly installed? Is the USB drive properly seated in the USB port THROUGHOUT the copy process?
The root directory cannot have more than X (224?) entries. I guess all your jpeg files have long file names, hence increasing the number of entries used. The solution is to put the jpegs in one or more subdirectories of the portable’s root.
ahh, Ervin you just beat me. Congrats
Ervin, you’re about 95% of the way there, which is close enough for me. The actual limit is 512 entries in the root directory on a FAT drive. Each filename and its 8.3 alias get one entry, and long filenames take up additional entries. In this case, there were four directory entries used for each file name, which meant I ran out of room at 128 files. Once I deleted a file or two and created a subfolder, I was able to move the existing files into it and then copy the rest of the files into that subfolder.
So, you’re the winner. Send me an email (ed-blog AT bott DOT com) with your mailing address and I’ll get the book out to you.
Thank you, Ed! I feel like I’ve just got an A+ prize for a B- answer. π
To be honest, looking up the exact numbers would have taken a lot more time, and I was pretty tired after carrying all the food I bought at Costco tonight.
I had a feeling it was the FAT root-directory file-limit issue! Darn! π
Dangit! I was close. Stupid job got in the way, so I couldn’t check the thread again for a couple of hours. Congrats, Ervin.
Thank you, Gerard and Carl!
It could have been any of you, guys. A quality blog like this must have quality readers. π
Thank you Ervin,
Your solution worked for me too.
I was intrigued by the question because it is close to a problem I am having. Running XP SP2 with the HD on my laptop using NTFS file structure and my external USB HD using FAT 32, I have trouble copying certain files from the Laptop to the External HD. Here is the reason: some of the files are in foreign languages and use diacritical marks, for example, Jose or Jos and an e with an accent on it. When I have two files that differ only because of the diacritical marks, when I try to copy them I receive the msg “Cannot create or replace . The directory or file cannot be created. By removing the diacritical marks everything is OK. Unfortunately I have a folder with about 20,000 files in it that I want to copy.
Does anyone know the solution to this problem?
Goodwill,
Luke