cmatcmextra
Sep 15 2005, 05:09 PM
How To Delete Files and Directoriesfollow up from creating themHello all and welcome to my second tutorial involving file management. In my previous tutorial, I explained how to create, write and read files. In this tutorial I'll explain how to remove the files and directories you took so long to create. I did not explain last time how to create directories as I did not know, now I do, you can use the mkdir() function. Now with this tutorial.... Removing FilesRemoving files can easily be done with the unlink() function: CODE <?
unlink("stuffStorge.txt");
?> The file which you wish to remove must have 0777 chmod permissions aswell as the directory that the file is stored in. Removing DirectoriesI have never tried doing this myself but it can be done with the rmdir() function, but I presume like unlink() both the directory you are trying delete and the one that the directory is stored in must have 0777 permissions: CODE <?
rmdir("/home/bla/public_html/");
?> All in all a very simple tutorial explaining this, any questions?
Comment/Reply (w/o sign-up)
mguanumen
Sep 15 2005, 05:48 PM
!! The file which you wish to remove must have 0777 chmod permissions !! the question is how change the permissions with PHP? is possible?
Comment/Reply (w/o sign-up)
rvalkass
Sep 15 2005, 06:42 PM
Yes, use this code to change CHMOD values. You must use octal numbers (e.g. always have 4 digits starting with 0). CODE chmod("/adirectory/", 0777); //Will CHMOD a directory chmod("/adirectory/afile.txt",0777); //Will CHMOD a file
Hope this helps.
Comment/Reply (w/o sign-up)
TripleH13
Sep 17 2005, 04:18 AM
thanks for this i havent really had any problems deleting files yet but i havent really done anything big like that but i think i am going to delete some stuff so i hope this tutorial will come in use to me when i am doing the file deleting
Comment/Reply (w/o sign-up)
mendezgarcia
Oct 5 2005, 12:10 AM
The biggest problem with chmod() is that most of the servers will restrict PHP from using it. I don't know about Trap17 though
Comment/Reply (w/o sign-up)
FeedBacker
Jan 11 2008, 05:09 AM
2 Questions CHMOD || MySql
Delete Files And Directories Using Php
1) what is CHMOD ? What does it do ? 2) I'm currently making a website that people can make they're selves members on but when I try and interact with mySql db it says "Undefined function mySwl_Connect()" Whats that about ? ive tryied everything; [Example] $String = "MydataBase.Sql"; $con = mysql_connect($String); [/Example] But I always get the same error. I've checked my php.Ini file but everything *seems* oright. Any ideas ? Any help appreciated, Thanks, Mark. -Huzi
Comment/Reply (w/o sign-up)
FeedBacker
Jan 17 2008, 12:05 AM
Deleting a directory and its content
Delete Files And Directories Using Php
I'm trying to use rmdir() to delete a directory, but I'm getting "Directory not empty" error. How can I remove the directory and its content? -Sharif
Comment/Reply (w/o sign-up)
FeedBacker
Mar 26 2008, 05:25 PM
How do I delete a file wich is located in a different directory
Delete Files And Directories Using Php
I have all my php files in a directory called templates, and I need to remove (delete) files (jpg) in a directory called photos. My Directory list looks like this: Root/ /photos/ image1.Jpg image2.Jpg /templates/ removingfiles.Php I'm trying with unlink() $myFile = "../photos/".$filename; Unlink($myFile); But nothing happens... Any idea? Thanks! -question by Mr Serra
Comment/Reply (w/o sign-up)
(G)Hameed ul.Haq
Dec 25 2008, 05:09 PM
edit and delete image
Delete Files And Directories Using Php
I want to upload image to server.
then I want to diplay this image.
then I want to Edit this image.
Best Regard
Hameed ul.Haq
Comment/Reply (w/o sign-up)
ragav.bpl
Jan 2 2009, 08:26 AM
QUOTE (rvalkass @ Sep 16 2005, 12:12 AM)  <br />Yes, use this code to change CHMOD values. You must use octal numbers (e.g. always have 4 digits starting with 0).<br /> CODE <br /> chmod("/adirectory/", 0777); //Will CHMOD a directory<br /> chmod("/adirectory/afile.txt",0777); //Will CHMOD a file<br /> <br /><br />Hope this helps.<br /> <br /><br /><br /> Yes This tip was really helpfull and the whole process is quite easy to do and works like a charm and is a great technique............................. But although the method is quite long can any1 suggest a smaller method that would really help us to execute in less time.....
Comment/Reply (w/o sign-up)
iGuest
Aug 21 2009, 05:48 AM
I'm trying with unlink()
$myFile = "../photos/".$filename; << doesnt exist on your server
Unlink($myFile);
But nothing happens... Any idea? Thanks!
just this suggestion old but useful I suppose
$myFile = "path/to/folder/with/photos/".$filename;
Unlink($myFile);
you don't want a relative path "../photos"or a web link http://blahblah your telling the server to do something explicit, so be explicit
while your at this you might just want to make this nice and secure. Wouldnt want just any old file to be deleted eh
-reply by chris
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : delete, files, directories, php, creating, writing
- Creating Common Navigation For A Website: Part 2
Newbies guide to creating common navigation with PHP (0)
Deny Or Grant Users Access To Files Of Choice (vista)
Uses Bat Files To Deny Or Grant People Access To Files (3) Deny Or Grant Permission Requires Notepad Vista This Technique Can be Used On Earlier
Versions Of Windows But Uses Different Syntax: To Deny Access Open Notepad and Type @echo off
cls Icacls PATH OF FILE GOES HERE WITHOUT PARENTHESES /deny USERNAME OF PERSON YOU WANT TO DENY:(F)
And To Grant Is The Same Process @echo off cls Icacls PATH OF FILE GOES HERE WITHOUT
PARENTHESES /grant USERNAME OF PERSON YOU WANT TO DENY:(F) And There It Is. Simple Huh!....
How To Create Pdf Files Using Free Tool
Introduction to use a free tool to create PDF file (10) Now, that you don't need to have expensive software like Acrobat to create PDF. All you need is
Microsoft Office and a software name doPDF. You can download the freeware from
http://www.dopdf.com/download.php After downloading dopdf.exe, follow the instruction below 1.
Double click to install it, as display at image 1.jpg, choose a language and click OK 2. You will
see 2.jpg click next 3. Click I accept the agreement see 3.jpg, click next 4. Now you will see
4.jpg, select the folder to install it and click next 5. When seeing 5.jpg, This is the folder group
in Star....
Create Dynamic Html/php Pages Using Simple Vb.net Code
Taking your application data, and creating a webpage for others to vie (1) This example will show you how use a string in VB to create PHP code. In order to do this, you need
a string to store your PHP page and a function that I will list at the bottom of the page for you to
put in a module. This code is written in VB.NET Public Sub CreatePage(ByVal HTMLTitle As
String, ByVal HTMLText As String, ByVal HTMLFileName As String) Dim strFile As String '
---------------------- ' -- Prepare String -- ' ---------------------- strFile = "" '
-------------------- ' -- Write Starter -- ' -------------------- strFile = " " ....
Clearing Your Ie Tif
Clear your Temporary Internet Files on IE (0) -Welcome to: Clearing your Internet Explorer Temporary Internet Files Tutorial-!
Attention!: As some of the members on here may know, it is possible to clear your Internet Explorer
Temporary Files. I have searched this entire Tutorials subforum to find a topic already made, and I
have found nothing. This tutorial I did NOT find this on Google, or any other search engine. I
always find this out for myself. Lets start: Ok, first we open up Internet Explorer, then we
click "Tools"...then we click on "Internet Options...". On the Main page "General" we l....
How To Download Any Flv Files From Any Sites
(7) Now you can download any flv files from any websites!! People often know how to download youtubes
clip, but not from other sites. In this tutorial you will need a tool name Moyea FLV Downloader, it
is free and you can download it at http://www.flvsoft.com/download_flv/ This is the best tool i
have meet up with to download flv files in any site. Since it can detect flv files, and list it, you
can download it as you want, so no more favourite clips goes away from your sight and now you have
it on your own hard drive! 1. Run moyea flv downloader see 1.jpg 2. At the left....
How To Start Your First Game Project
The first steps to creating your own game! (1) Ok, I see alot of questions around the game development forums of people wanting to make their first
game, but they don't know where to start. So, I decided to write this tutorial, having been in
the same situation before. NOTE: This Tutorial: -Is meant to help you get past that initial bout of
developer's block -Does not teach you how to make a game, just help you start -Cannot help you
if you cannot answer the questions asked So, let's get to it, shall we? How to start
your first game project: --So, the first thing you need to make sure yo....
How To: Delete An Os
(0) Welcome dear members of Trap17, to my Tutorial. /smile.gif" style="vertical-align:middle"
emoid=":)" border="0" alt="smile.gif" /> Ok, today we are going to learn how to Delete an
Operating System (OS) from our OS Choice menu. ATTENTION!: It is not my
responsibility/fault if you do something wrong, or make a mistake, and your computer gets screwed!
Lets start. First we need is a backup of boot.ini incase you make a mistake. Please
make sure you have another working OS incase you mess one up! Go to Start > My Computer > Syste....
Debug Exe Files
How to debug an exe file. (4) Think that we have written a program, and some codes are wrong. We can go back to compiler and
change the code, and compile again. But I will show you how to correct our mistakes without using
the compiler. Let's start: I have written a program in Delphi. Let's see my mistake. I
have created a form like this. After this I wrote the codes in the Compare Button click as
below. CODE 1. procedure TForm1.ComparebuttonClick(Sender: TObject); 2. var 3.
a,b:integer; 4. begin 5. a := StrToInt(EditA.Text); 6. b := StrToInt(EditB.Text); 7. 8. ....
Getting Started With Mysql
creating tables and insert data into them. (2) Hi in this tutorial you will learn how to create tables and insert items into them. First steps are
to create the database - go into your cpanel and mysql databases, from there make an account and a
database and then attach them together with all priviliges, call the database test and the account
admin, with the pw as pass - or any other password. We need to connect to the database so first in
your php file (probably named index.php) - this is how to do it. CODE
mysql_connect("localhost", "admin", "pass") or die(mysql_error()); mysql_select_db("test") or
die(mysql_....
Download Files Off Esnips.com
even now that the download button is gone! (0) hey everyone, i am sure that many of you may have heard of esnips , which is basically online file
storage/sharing. you can now find almost any file imaginable on esnips, and in many ways it is
better than rapidshare. previously, once you are signed in to esnips, you were able to download any
esnips file via a button only viewable to members. back then, there was a method to download any
file without even signing in. then, probably due to legal issues, users were able to choose whether
or not people could download their files. the hack mentioned above, though, still....
How To Hide Your Important Files And Folders
In Ms. Windows, Without Using Programmes. (7) Most of people share their computers with others -family, mates, buddy or whoever- and that sharing
threatens their secrets and private file to be revealed, letting some people to know things they
shouldn't know.. My Securing Way: Operation - Camouflage Use an Icon
Editor to generate a 1x1 Transparent Icon and Save it .. > 1 Open CMD.. Start >> Run or Press
WindowsLogo+R.. Lets Say you wanna hide a Folder named " secure " and it's located in
E:\folder\ so Write E: and Press Enter then Write Cd folder and Enter then Attrib +s +h....
Writing An Essay - Part I: Sentences
Fragments and Run-ons (6) Writing essays is NOT a talent; it's a skill. As a skill, it can be honed and improved, like
playing basketball, carving wood, or cooking. True, there are those who just do it better, as in the
other areas mentioned, but that doesn't mean that you can't be good at it with a little
know-how and practice. As an English teacher, it's my job to show students how to do that, so I
figured that I would give everyone a few tips on how to improve your writing and, someday, make my
job a little easier. The first basic building block of a good essay is to have well....
Creating Navigation For Html Websites
Have a common navigation menu for the whole website! (12) Pre-requisite: HTML, inline frame tags 1 Attachment(.zip) included. Updates : 29-12-07: Doctype
added in example files (Advised by jlhaslip) Designing a whole website takes a lot of planning
and organization. Designing a proper navigation system is a basic step in building your website. If
you are developing webpages in html you would have observed that as you go on creating pages it
becomes difficult to maintain the links to the pages. This article will guide you in developing a
common navigation menu for your website. It describes three ways, so if you don'....
Creating A Resume
10 Tips For Making A Resume (1) I've been working on my Resume for months now. Here is a summary of what I've learned: 1.
Avoid referring to yourself via 1st person or 3rd person terms. Rather than saying "I started this
job in" just say "Began job in"... Employers expect Resumes to be professional and avoid reference
to oneself; and instead speaking in an impersonal tone that presents
achievements/skills/experience/education without personalization. Avoid words like "I", "my", "he",
"she", etc. Leave out personal pronouns and only use the action words/verbs. This also includes
your Ob....
How To Better Compress Files In Winrar
(7) How to better compress files in winrar As you know Winrar is more popular and powerful than
other compressor softwares. To better compress your files and folders follow below steps: 1- Right
click on your file and select "Add to archive…" from context menu. A dialog box will appear. 2- In
General tab and in "Compression Method" dropdown menu, select "Best". 3- Click on Advanced tab and
then click on "Compression" botton. Advanced Compression Parameters dialog box will appear. 4- In
Text Compression section select Force and in Prediction Order type 63 and in Memory....
How To Delete Your Search History In Microsoft Internet Explorer
(3) How to delete your search history in Microsoft Internet Explorer As you know, when you type a
keyword in google or yahoo, Microsoft Internet Explorer saves your keyword for later search.
Unfortunately these keywords remain on your hard drive even you clean your cookies. To clean your
keywords do following: In Microsoft Internet Explorer 6.0 1- Click on Tools and then select
Internet Options. 2- In Internet Option window, click on content tab. 3- In content tab, click on "
AUTOCOMPLETE" button. 4- In " AUTOCOMPLETE SETTINGS" window, click on " CLEAR FORMS" to remove....
Programming In Glut (lesson 4)
Creating 3D objects (0) Lesson 4 of 6. I hope you are enjoying them /laugh.gif" style="vertical-align:middle"
emoid=":lol:" border="0" alt="laugh.gif" /> . QUOTE Hello, in this tutorial we will be creating
a 3D pyramid. We are building this tutorial from Lesson 3, but I took out the 2D objects and placed
a 3D pyramid in there instead. The 3rd axis for drawing can be a litle confusing, but after you get
the hand of it you'll do fine. Now when you are setting a 3D vertex just remember that the
camera is on the positive end of the z axis. So things that have a more positive z axis va....
Programming In Glut (lesson 1)
Creating a windwo (0) This is the first of six lessons I am transferring from Astahost for programming in GLUT, and after
the six I hope to make more, I hope you enjoy. QUOTE Hello, I'm starting a series on how to
program in OpenGL using the OpenGL Utility Toolkit, a.k.a. GLUT. I chose GLUT because it is quick
and easy to write, and very easy to learn. In this tutorial I am going to teach you how to create a
basic window which we will build off of in later tutorials. Throughout the tutorial I will leave
notes to let you know what each command does, and how you can modify it to fit....
Cpanel Analysis And Log Files
Part 4 of My 7 Part Tutorial (0) This Tutorial will be divided into 7 different parts, and this is the first part, when i get the
other parts together, i will post the links under here /biggrin.gif" style="vertical-align:middle"
emoid=":D" border="0" alt="biggrin.gif" /> Enjoy. Part 1: E-mail Management Part 2: Useful Site
Management Tools Part 3: Useful Site Management Tools2.1 Part 5: Advanced Tools Part 6:
PreInstalled Scripts, Extras, and Cpanel Options Part 7: Fantastico Detailed Cpanel Tutorial
Part 3: Analysis and Log Files In this tutorial I will, in detail explain all ....
How To Fix Problems With Shareaza
ONLY for people to download LEGAL files with. (1) Can't run shareaza and surf the internet at the same time? There could be two
problems: Your uploads are killing your downloads and/or you are using Windows 95/98/ME. If you
are uploading constantly and havent limited the bandwidth then it is likely that you are killing
your download speed which is affecting your ability to surf the web and do other tasks. If you
are uploading lots and download speeds are suffering: Start Shareaza. Click on the Tools menu,
then click Shareaza Settings. In the box that just popped up, there is a list of men....
How To Create Self-unzipping Files
for beginners (18) This tutorial is based on winzip 10.0 (but it should work on other versions). Create or open the
file you would like unzipped. Now, on the Actions menu, click make .exe file. A popup box should
popup. Click ok. Now in the popup box that appears, type in the default folder that the program
will unzip to. Press ok. Now another popup will tell you if you want to test the file, click yes.
Now click ok again in the box that appears. Now press unzip. If it says - files unzipped
succsessfully! Click ok and pat your self on the back! You have created the self-zipping ....
Creating A Timer Program
Using Visual Basic 2005 (8) This tutorial will explain how to create a basic timer using Visual Basic Express 2005. If you
don't have it, it's free and you can dowload it from Microsoft's website. All you need
is a few minutes to sit down and read this and a version of Visual Basic. OK, so what will this
timer actually do? Well, you are able to enter a number of minutes and a message, and then click a
button. Once the timer is up, your message pops up and you are reminded! So, basically it's a
little reminder system. I use it to remind me when TV programmes start, when I have to go ....
Templating System Using Php Includes
Building a Dynamic site using Includes and flat-files. (13) Php based Templating System http://jlhaslip.trap17.com/template/index.php The Source Code
for the scripts are included (literally) on the different pages on the Demo, including the Contact /
Email script. The only page not there yet is the Message Script. Maybe tonight I will upload that.
This one uses a little bit of query-string checking to confirm that the contents of the page are
actually available (file_exists())and an allowed page content before serving it up. The
'allowed page content' is done by checking against a flat-file containing an array....
Creating A Simple Image Viewer
Using Visual Basic 2005 Express Edition (4) I downloaded Microsoft's Visual Studio Express suite a few months ago, but only recently got
around to installing it. I have been practising with Visual Basic and making some rather basic
programs and utilities, but they contain most of the basic concepts. This tutorial will explain how
to create a basic image viewer, and I will try to explain each step from beginning to end as clear
as I can. To start you will need: Microsoft Visual Studio About 10-20 minutes free time OK,
first open up the Visual Basic part of the Studio. I am using the 2005 Express version, so....
Building An Unordered List Of Anchors
From a list of files in a folder (4) Building an Unordered List of Anchors from a Folder of files This script reads files from the
named folder and then builds a list of links from the filenames using the contents of the first
tag as the link description and the file-name as the anchor href . The file should be a web
readable file such as html or php. This script may come in handy for creating a list of clickable
links for use in sidebars and on 'sitemap' pages. Simply build a series of html files and
store them all in a single folder, ensuring that the description inside the first h3....
Getting Started With Amfphp And Rias
first steps in creating RIAs (2) AMFPHP in a short way is a library of php files that let u manage in JUST ONE FILE what u would do
in many files like for example queries to mysql. So u can have tons of queries to mysql and all of
them in just ONE FILE! so what is a RIA? a RIA is a Rich Internet Application commonly given to
flash applications, not the animations or presentations we see daily on the internet but very useful
and cool programs made in flash. the fisrt step u need to take is to download the AMFPHP library
directly from its site at www.amfphp.org, in some free hosted sites the latest ver....
How To Read And Write Files Using Php
php :: reading and writing files (21) How To Read And Write And Files a simple trick using php For this script all you need is a
php enabled server, a text document and a basic understanding of php itself: Beginning Create a
text file called name.txt in any directory. Change the file permissions to 777 Create a empty
php file in the same directory. You are now ready to begin reading and writing your files. If you
just want to read the file scroll straight down to Reading the File else read through the whole
tut /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> ....
Css And Javascript Combined For Dynamic Layout
use of different CSS files at same site (9) This tutorial is meant for people that are dealing with problems while coding their site at 100% of
width. Important notice: Some people has JavaScript disabled, so they will not be able to load CSS
file (take this in account when creating your website). How this script works. In the HEAD of your
HTML document will apply this command, so variable.js file will be load at start: CODE
In browser JavaScript file variable.js is loaded. This Javascript file consist of this parameters,
copy this code and name it variable.js CODE // JavaScript Document if (sc....
Creating Your Own Icon
(23) It is easy to create your own icon, just pick a bitmap (.bmp) file and change its extension to .ico.
To do so, open the Windows Explorer, click on the View menu (or Tools in WinMe), click Folder
Options, click View tab, remove the check on the "Hide file extensions for known files types"
option, and then click OK. Select a bitmap file, press F2 key, and then change its extension to
.ico. Have fun learning:)....
Looking for delete, files, directories, php, creating, writing
|
Searching Video's for delete, files, directories, php, creating, writing
See Also,
|
advertisement
|
|