473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

KillDir not with long filenames?

Hello.

When I use killdir to delete a file, only names from 8 characters or shorter
wil delete.
But names like MYFILE~1.TXT don't work with killdir.

FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
KillDir FileName$

Above doesn't work.
When I do it in DOS prompt with DEL C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT, then
it works.
I can't do it with other names because I get the shortnames (with tildes
"~") from another Windows program.
This program gives no long, full names.

Is there another command to delete a file, given with the short names?
For example to use the DOS command DEL.


Jan 29 '06 #1
4 4974

"Fritsch Kieftenbelt uit Raalte (Bij Marienheem)"
<fr***************@NOSPAM.wanadoo.nl> wrote in message
news:43**********************@news.wanadoo.nl...
Hello.

When I use killdir to delete a file, only names from 8 characters or shorter wil delete.
But names like MYFILE~1.TXT don't work with killdir.

FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
KillDir FileName$

Above doesn't work.
When I do it in DOS prompt with DEL C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT, then it works.
I can't do it with other names because I get the shortnames (with tildes
"~") from another Windows program.
This program gives no long, full names.

Is there another command to delete a file, given with the short names?
For example to use the DOS command DEL.


Never heard of KillDir.. Sorry for being stupid but what is it? I know the
KILL command and you supply a filename. ..

Have you tried just using SHELL to shell out to DOS and execute the Delete?
Beste wensen van New York.
Jan 30 '06 #2
Fritsch try this for a file

Dim FileName as String
FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
Kill FileName$
for a dir and all its files try this
add a reference to the Microsoft Scripting Runtime type library

Dim fso As New Scripting.FileSystemObject
fso.DeleteFolder "C:\PROGRA~1\MYDIRS~1" ',True ',True deletes read only
files also

George
"Fritsch Kieftenbelt uit Raalte (Bij Marienheem)"
<fr***************@NOSPAM.wanadoo.nl> wrote in message
news:43**********************@news.wanadoo.nl...
Hello.

When I use killdir to delete a file, only names from 8 characters or
shorter
wil delete.
But names like MYFILE~1.TXT don't work with killdir.

FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
KillDir FileName$

Above doesn't work.
When I do it in DOS prompt with DEL C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT,
then
it works.
I can't do it with other names because I get the shortnames (with tildes
"~") from another Windows program.
This program gives no long, full names.

Is there another command to delete a file, given with the short names?
For example to use the DOS command DEL.

Jan 30 '06 #3
You can also use the following:

public sub KillDir(byval dirName as string)
dim cmd as string
if dir(dirname) = "" then exit sub
cmd = environ$("Comspec") & " /c rm /q/s " & dirname
shell cmd
end sub
Mike Ober.
"George Bashore" <gb******@bcpl.net> wrote in message
news:M-********************@comcast.com...
Fritsch try this for a file

Dim FileName as String
FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
Kill FileName$
for a dir and all its files try this
add a reference to the Microsoft Scripting Runtime type library

Dim fso As New Scripting.FileSystemObject
fso.DeleteFolder "C:\PROGRA~1\MYDIRS~1" ',True ',True deletes read only files also

George
"Fritsch Kieftenbelt uit Raalte (Bij Marienheem)"
<fr***************@NOSPAM.wanadoo.nl> wrote in message
news:43**********************@news.wanadoo.nl...
Hello.

When I use killdir to delete a file, only names from 8 characters or
shorter
wil delete.
But names like MYFILE~1.TXT don't work with killdir.

FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
KillDir FileName$

Above doesn't work.
When I do it in DOS prompt with DEL C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT,
then
it works.
I can't do it with other names because I get the shortnames (with tildes
"~") from another Windows program.
This program gives no long, full names.

Is there another command to delete a file, given with the short names?
For example to use the DOS command DEL.



Jan 30 '06 #4
On Sun, 29 Jan 2006 19:20:16 +0100, "Fritsch Kieftenbelt uit Raalte
\(Bij Marienheem\)" <fr***************@NOSPAM.wanadoo.nl> wrote:
Hello.

When I use killdir to delete a file, only names from 8 characters or shorter
wil delete.
But names like MYFILE~1.TXT don't work with killdir.

FileName$ = "C:\PROGRA~1\MYDIRS~1\MYFILE~1.TXT
KillDir FileName$

Above doesn't work.


I doubt that it is short file names

If the current directory is the one you want to kill, then one cannot
RmDir the directory
- same goes if one is in a Dir() loop inside the directory

It would be interesting to see the code for KillDir()
Jan 30 '06 #5

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

Similar topics

9
by: Melissa | last post by:
Hi, I'm new to the group and haven't had a chance to read the FAQ, but I have a question that's driving me crazy. If anyone here can help me with this or can point me to another site or...
4
by: Anthony Lansbergen | last post by:
Hi, My (pre)compiler(s) (borland C++ builder 5 and g++) both seems to have a problem with the new include format. In stead of #include <iostream.h> I want to say #include <iostream>. This...
3
by: Kevin Ollivier | last post by:
Hi all, On Windows, it's very common to have a string of long directories in the pathname for files, like "C:\Documents and Settings\My Long User Name\My Documents\My Long Subdirectory...
2
by: ROBB | last post by:
Hi, I'm trying to find a way to manipulate files with kill, FileCopy, Dir, etc. The problem is that they are very long filenames, and these commands are not reliable with pinpointing the exact...
1
by: Pieter | last post by:
I want to be able to split regular MAX_PATH length filenames and 32K UNICODE filenames using the \\?\ naming convention. Are there any equivalents to _tsplitpath() for long names, or am I left to...
2
by: Seth | last post by:
Ok, here is my setup. I have a fully functioning HTTP Handler implemented. The handler is supposed to handle every single request that comes in to a particular virtual directory. Thus, in IIS, I...
0
by: n33470 | last post by:
We have a web site that is being converted from the 1.1 format into 2.0. I've noticed that after the web project has been converted, the first time that the solution is opened in VS, all of the...
0
by: chongming | last post by:
Hi, i want to display all the filenames on browser. However i found that if there are many filenames in that folder, result will be it will display a long list of filenames on that browser. My...
2
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I work in a company where we tend to use very deep folder structures and long descriptive file names due to the nature of the analysis that we make. I've made a program that recursively...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.