473,666 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving files with large file names into Recycle Bin

Hi, I am trying to delete files programmaticall y 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.jp g"
it will not. However, if the file is named "testerfiles.jp g" and I try
to delete "tester~1.j pg", 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_NOCONFIRMAT ION flags. Any
help in this would be greatly appreciated. Thanks!

Jun 12 '06 #1
2 1658
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:\testerfile s.jpg" + "\0";

Hopefully this helps someone in the future.

aval...@gmail.c om wrote:
Hi, I am trying to delete files programmaticall y 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.jp g"
it will not. However, if the file is named "testerfiles.jp g" and I try
to delete "tester~1.j pg", 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_NOCONFIRMAT ION flags. Any
help in this would be greatly appreciated. Thanks!


Jun 12 '06 #2

<av*****@gmail. com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
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:\testerfile s.jpg" + "\0";

Hopefully this helps someone in the future.

aval...@gmail.c om wrote:
Hi, I am trying to delete files programmaticall y 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.jp g"
it will not. However, if the file is named "testerfiles.jp g" and I try
to delete "tester~1.j pg", 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_NOCONFIRMAT ION flags. Any
help in this would be greatly appreciated. Thanks!


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

Mythran

Jun 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2748
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do understand the objective. This example may represent an interface in need of a bit of refactoring, but it goes to demonstrate the basic idea as I understand it. http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/ast_8h-source.html...
6
8903
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? I am running UDB 8.2 on Linux and AIX. Thanks.
12
39654
by: deko | last post by:
Is there a quick and dirty way to delete all files in a given directory? perhaps something like this: Set objFile = CreateObject("Scripting.FileSystemObject") objFile.DeleteFile "all files in C:\Temp" 'how to specify directory? Do I need to use the Windows API? Private Declare Function FindFirstFile Lib "kernel32 Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As
16
5077
by: Lacka | last post by:
Hi, How can I transfer files via FTP under asp.net? Don't found any info... thanks, Lacka
4
5925
by: rob | last post by:
Does C# 2005 have an easy way to delete files to the recycle bin?
7
10818
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're doing a proof-of-concept on WCF whereby we have a Windows form client and a Server. Our server is a middle-tier that interfaces with our SQL 05 database server.
1
5968
by: Riky | last post by:
hi i have a windows application. I am select the folder or file name from the folderbrowserdialog box and to delete the folder or file i am calling the following code. Public Function DeleteFile(ByVal path As String) As Boolean 'Delete a specified file Try If File.Exists(path) = True Then File.Delete(path)
4
2152
by: Alex | last post by:
Hello, This is a follow-up to my earlier post about having issues with our application pool recycling. We currently use Session State InProc, but if I were to choose to move the existing application to SQL instead, would the only change in the application be the SessionState setting within web.config? I know I'd also need to setup our MS SQL database to handle sessions (detailed in MS Article 317604), but outside of this, is there...
4
2253
by: tdahsu | last post by:
All, I'd appreciate any help. I've got a list of files in a directory, and I'd like to iterate through that list and process each one. Rather than do that serially, I was thinking I should start five threads and process five files at a time. Is this a good idea? I picked the number five at random... I was thinking that I might check the number of processors and start a multiple of that, but then I remembered KISS and it seemed that...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.