Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deletedir does not work with *.* file search 2

Status
Not open for further replies.

arteep

Programmer
Jun 16, 2004
8
CA
Hello. I am a new programer to paradox. I have tried to move windows files around using filesystem commands.

I use a *.* to find all the files in a directory.
I copy the files to another directory.
Then I try to delete the orginal (now empty directory)using
the command "deletedir".

I get an error message saying: another process or user is using the file. Close the process and try again.

If I go to windows explorer i cannot delete the directory either.

I have to close Paradox, then I am able to delete the directory using windows explorer.

I believe this is related to the "." and ".." files created when I use *.*

Any Ideas on how to overcome this??

I'm using Paradox 9 on Windowsxp

 
There is no reason that this shouldn't work, I don't think it's related to the "." and ".."." This should be fairly simple processm can you post your code?

Perrin
 
Here is the code. By the way I lied when I checked off programmer as you can see below.


The heart of this thing is in the WHILE loop about 1/2 way down. Here I look for files then copy them all over to ARCPROGRAM FILES.

THen at the very end I try and delete the dir with fs.deletedir(newdir)

I'm running this from a form.


Thanks for your help




method pushButton(var eventInfo Event)
Var
Quotenum String
OrdComm Table
Quotem2 string
Fordcomm form
Quotem1 string
neworderNum String
orderTbl Table
tc TCursor
Z,W,Y,Q,t string
tcVar string
ordernum string
arcdate date
tcCust, tcArc, tcComm, tcOrder TCursor


; these vars for windows file archiving

newdir String
otherSes Session
arcdir String
vendorname String
; String
CustomerName String
Custshort String
Vendornameshort String
fs FileSystem
returnValue Logical
Driveletter String
fs2 filesystem
name string
filenames Array[] string
p PopUpMenu
tv TableView
choice, path String

EndVar


Action(DataBeginEdit)

Action(DataPostrecord)
action(DataBeginEdit)

;this section finds and copys then deletes files



vendorname = Vendor_Name.value ;for creating dir path
Quotenum = Quote_No_.Value ;for creating dir path
CustomerName = Customer_Name.value ;for creating dir path
Custshort = CustomerName.substr(1, 15)
Vendornameshort = vendorname.substr(1, 15)
IF getNetUserName() = "Art Melanson" then
Driveletter = "G"
else
Driveletter = "C"
endif
if msgYesNoCancel ("confirm", "Move files from directory PROJECT FILES to ARCPROJECT FILES?") = "Yes" then

newdir = Driveletter + ":\\PROJECT FILES\\" + Vendornameshort + "\\" + Quotenum + " " + Custshort
if isDir(newdir) then
fs.setDir(newdir)
arcdir = Driveletter + ":\\ARCPROJECT FILES\\" + Vendornameshort + "\\" + Quotenum + " " + Custshort
fs.makedir(arcdir)


[highlight]if fs.findFirst("*.*") then ; if a *.* file exists
while fs.findNext()
name = fs.name()
arcdir = Driveletter + ":\\ARCPROJECT FILES\\" + Vendornameshort + "\\" + Quotenum + " " + Custshort + "\\" + name
If Not (name = ".") then
If not (name = "..") then fs.copy(name, arcdir)
fs.delete(name)
endif
endif
endWhile

endIf[/highlight]

action(DataENDEdit)
clearDirLock(newdir)
[highlight]fs.deletedir(newdir)[/highlight]
else
msginfo("Windows directory does not exist", newdir)
endif
endif
 
I think the problem is you are not deleting the "." & "..", If you move the fs.delete() outside of the if..then block you should be ok.

if fs.findFirst("*.*") then ; if a *.* file exists
while fs.findNext()
name = fs.name()
arcdir = Driveletter + ":\\ARCPROJECT FILES\\" + Vendornameshort + "\\" + Quotenum + " " + Custshort + "\\" + name

If Not (name = ".") then
If not (name = "..") then
fs.copy(name, arcdir)
endif
endif
fs.delete(name)
endWhile

endIf
 
Hi.

Thanks again for your help. THe solution did not work. I went to another group and found hundreds of references to this problem. if you go to comp.databases.paradox group.

(i got there by Google groups, search on "corel paradox"

then click on comp.databases.paradox.

then search on "deletedir")

THey have hundreds of references but no solution that I could find.

I do notice that the group seems to stop in about year 2000.

This deletedir problem was/is very common but the solution does not seem easy to find


 
Have you tried adding a sleep() between the copy and the delete? A copy is not an instant process and the file is being locked by the OS during it. Try starting off with a high sleep value and a small number of files of various sizes.

Second, I get errors similar to this while using explorer in XP sometimes. I delete a file or two and then try to delete the directory and get a message that the file is in use. I'm wondering if this could not be OS related.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Sleep didn't work. I know this problem can be fixed. But how?

Anymore suggestions.

 
Hmmm, Haven't come across this problem before. The code works perfectly on my system although I'm using V10 on XP. There are a large nuber of news group posts regarding deletedir problems but if you check the date most of them are several years old making me thing that the problem may have been fixed with V10.
 
Thanks Everyone.

I gave up trying and just ordered V10. I hope this fixes the problem.

Ar
 
Be sure and let us know if it solves the problem.

Perrin
 
Hello All.

I bought Paradox 11 from corel (it is just packaged with WP11).

THe deldir works perfect.

This was a bug in the paradox 9 program which they fixed in paradox 10, 11
 
I thought you could only lease Paradox 11. Have they come to their senses, or was I misinformed?
 
You have to purchase it with WP11. Then install only paradox 11.

art
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top