Moving files with large file names into Recycle Bin

  • Thread starter Thread starter avalain
  • Start date Start date
A

avalain

Hi, I am trying to delete files programmatically and put them in the
Recycle Bin. I am using SHFileOperation and everything works fine,
except when I try to delete files with more than 10 characters in the
name (not including the extension). So if the file is named
"testerfile.jpg" it will work. If the file is named "testerfiles.jpg"
it will not. However, if the file is named "testerfiles.jpg" and I try
to delete "tester~1.jpg", it will work as well. This looks like how
MS-DOS used to work, except with 10 characters instead of 8.

Is there any chance there is a flag or something that needs to be set?
I am currently using FOF_ALLOWUNDO and FOF_NOCONFIRMATION flags. Any
help in this would be greatly appreciated. Thanks!
 
Oop, so I figured it out! One thing that I hadn't seen on these posts
before is that a null character is required at the end of the file
name. So I had to do this:

shf.pFrom = @"c:\testerfiles.jpg" + "\0";

Hopefully this helps someone in the future.
 
Oop, so I figured it out! One thing that I hadn't seen on these posts
before is that a null character is required at the end of the file
name. So I had to do this:

shf.pFrom = @"c:\testerfiles.jpg" + "\0";

Hopefully this helps someone in the future.

hmm....could just do "C:\\testerfiles.jpg\0"; :)

Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top