Questions tagged [unlink]

Refers to removing a file from a filesystem.

This tag is appropriate for questions about deleting a file from a filesystem whether by using a language-specific function such as Perl or PHP's unlink or by making a system call such as Unix's unlink.

Wikipedia has more information about unlink.

526 questions
0
votes
2 answers

Could not unlink

I'm totally puzzled with unlink() here: my $file = "\"/home/user/Documents/Programming/Perl/extracted/Prueba con formateo HTML/msg-2575-4.html\""; unlink($file) or warn "Could not unlink $file: $!"; will throw Could not unlink…
m0skit0
  • 25,268
  • 11
  • 79
  • 127
0
votes
1 answer

unlink function not working on files over 1mb

Does anyone know why the unlink function would be working with a file under 1mb but fails with one above 1mb? Is there a setting in the php.ini I need to change? Cheers
0
votes
1 answer

how to delete a php file using php?

I want to delete another php file from the server using unlink() function: unlink('../classes/methods.class.php'); but I get a permession denied warning . although i made chmod 777 to that file
A7S
  • 141
  • 1
  • 8
0
votes
2 answers

Perl - File deletion not happening

I have a file in which I have to add 2 lines. For that I open the file, read the lines, add new lines and save the file as a new temp file. Now I want to delete the original file and rename the new file to original file name. But somehow it is not…
CamelCase
  • 213
  • 2
  • 6
  • 16
0
votes
1 answer

Cron job doesn't "unlink" files - why?

I have a php script that deletes a file from a specific folder on my server: if (file_exists($_SERVER['DOCUMENT_ROOT']."/folder/file1")) { unlink($_SERVER['DOCUMENT_ROOT']."/folder/file1"); } When I go to this script address with my browser it…
Bobbi X
  • 189
  • 1
  • 9
0
votes
1 answer

unlink or rmdir cant remove folder.only remove file in folder

i have file in upload/project1/update. the problem is,only files in update is deleted. i want to remove the directory in folder upload...thats mean,folder name 'project1' and 'update' also delete after the files in update is deleted.can u spots the…
0
votes
3 answers

Not deleting the correct file in PHP

I am facing problem deleting the correct files. I am displaying the list of files uploaded by the user sorted by the time of upload (last upload first). If there's a list of 3-4 files, no matter which file I click to delete, the first file in the…
Ankur Sinha
  • 6,473
  • 7
  • 42
  • 73
0
votes
2 answers

unlink php error with & in file name

I can't unlink file with php if there is & in file name. unlink('../mydoc/in&out.pdf'); The error said: no such file or directory
0
votes
1 answer

PHP Server Creates a File That It Can't Delete

I originally posted a much different question because I didn't know why I couldn't unlink (delete) a file that the server had already created; I've discovered a bit more information and thus feel it is appropriate to reword my question. The PHP…
weildish
  • 17
  • 1
  • 6
0
votes
0 answers

Unlink Function Not... Unlinking

So I have function that creates a file, exports data to it, lets the user download it, and then lets the user delete it. Everything works except for deleting it. I don't know if it's because the unlink function doesn't really work within a $_POST…
weildish
  • 17
  • 1
  • 6
0
votes
1 answer

Do a php function code on a link

I'm looking for a way to do a function with php when clicking on a link. I mean to delete an item when clicking on this link. I got my code set up like this: $files = glob("upload/*.*"); if(count($files) == 0){ echo "No files present"; } else…
Axll
  • 55
  • 6
0
votes
1 answer

Attachement file deletion after sending out an email

In a larger project, have a form which uploads 2 files. I am using codeigniter as the framework. After the form upload it should send these 2 files as an email. In order to attach it to an email, we should have a local copy of the file. Hence I move…
footy
  • 5,803
  • 13
  • 48
  • 96
0
votes
2 answers

PHP - Deleting a file listed in a Directory through a hyperlink

I'm trying to list all files in a directory and delete a file if a 'DELETE' link is clicked, however, it's telling me that the file is non existant showing me these error messages: Notice: Undefined index: dir in…
Brian
  • 1,951
  • 16
  • 56
  • 101
0
votes
1 answer

PHP Directory Tree - Deleting Folders

I have found a script that lists all directories and files in them, and allows for the deletion of files. I have two problems: 1) How do I add the function to delete a folder (With all the contents in it) 2) How do I make the script not to allow a…
Brian
  • 1,951
  • 16
  • 56
  • 101
0
votes
1 answer

Delete the file without knowing its type

Can I delete the file without knowing its type in php? I want to do something like this: unlink('../gallery/images/pic23.?) How can I perform this ? Thanks in Advance