delete-file -> file-error

Discussion of Common Lisp
I X Code X 1
Posts: 59
Joined: Sun May 29, 2011 8:52 pm
Location: NY
Contact:

delete-file -> file-error

Post by I X Code X 1 » Sat Jun 11, 2011 12:40 pm

Hello,

I am running lisp on Allegro CL Express Edition and am getting this error when I try to delete this file. Note: the file does exist and I am running this on Windows.

Code: Select all

CG-USER(12): (delete-file "C:/acl82express/output.txt")

Error: deleting "C:\\acl82express\\output.txt" resulted in error (code
       13): Permission denied.
[condition type: FILE-ERROR]
I am getting the same error with rename-file. Any idea why this might be happening? I've tried it with a pathname too (#p), but both the pathname and namestrings are giving me this error :cry:

Thanks!

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: delete-file -> file-error

Post by ramarren » Sat Jun 11, 2011 12:50 pm

The error message tells you what the error is: permission denied. Windows has had file permissions for a long time now. Unfortunately I don't really know in detail how that works there, but presumably the file was created by a different user or is read only. Check file properties.

I X Code X 1
Posts: 59
Joined: Sun May 29, 2011 8:52 pm
Location: NY
Contact:

Re: delete-file -> file-error

Post by I X Code X 1 » Sat Jun 11, 2011 12:58 pm

Gah, I was hoping you weren't going to say that. I've gone into the file and change it's permissions -- allowing everything. Also went to the directory itself and changed it's permissions -- again allowing everything. Yet I am still getting this error. Is there perhaps a better way to delete files/rename files on Windows using CL?

Thanks!

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: delete-file -> file-error

Post by ramarren » Sat Jun 11, 2011 1:04 pm

Are you sure it is not set read only? I believe the attribute is set in a different tab that permissions as such.

I don't think there is a better way. Unless you want to directly call Windows API, but presumably it would tell you the same thing.

I X Code X 1
Posts: 59
Joined: Sun May 29, 2011 8:52 pm
Location: NY
Contact:

Re: delete-file -> file-error

Post by I X Code X 1 » Sat Jun 11, 2011 1:11 pm

Well I have written to it. I just made a simple .txt file, wrote some text to it, and now I am trying to either delete or rename it. The read-only check box has not been checked and has read,write and modify permissions.

Hmm, I guess I blame windows :roll:

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: delete-file -> file-error

Post by Indecipherable » Sat Jun 11, 2011 1:13 pm

Try deleting the file if it is e.g on your desktop.
Don't take the FUN out of DEFUN !

I X Code X 1
Posts: 59
Joined: Sun May 29, 2011 8:52 pm
Location: NY
Contact:

Re: delete-file -> file-error

Post by I X Code X 1 » Sat Jun 11, 2011 1:15 pm

Actually, looking back at it...I have found that the directory is set to read-only. However, any attempt to change this is not working. I uncheck it and when I come back it has been checked again. I did of course hit apply and ok.

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: delete-file -> file-error

Post by Indecipherable » Sat Jun 11, 2011 1:18 pm

I also have such permissions, but you do not seem to be bound by any "windows chains" outside the Program Files directory, etc.
Don't take the FUN out of DEFUN !

I X Code X 1
Posts: 59
Joined: Sun May 29, 2011 8:52 pm
Location: NY
Contact:

Re: delete-file -> file-error

Post by I X Code X 1 » Sat Jun 11, 2011 1:23 pm

Indecipherable wrote:I also have such permissions, but you do not seem to be bound by any "windows chains" outside the Program Files directory, etc.

Sorry, this is the first time I've really tried working with files. Are you saying there is a way to stop this from happening and allow me to look into the contents of this directory and modify/delete files?

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: delete-file -> file-error

Post by Indecipherable » Sat Jun 11, 2011 1:28 pm

Now I am not so sure... What is the default directory that you are in when the terminal loads? Try typing (cd)
Don't take the FUN out of DEFUN !

Post Reply