Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Pascal/Delphi

Pascal/Delphi Forum for discussing Borland Delphi and Pascal coding techniques, tips and tricks.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-12-2006, 01:07 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default Check if a file exists?

Similar to the C++ thread, how can I check if a file exists in Delphi?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-15-2006, 10:56 PM
BuildPromoteWin's Avatar   
BuildPromoteWin BuildPromoteWin is offline
Newbie
 
Join Date: Jul 2006
Posts: 10
Rep Power: 0
BuildPromoteWin is on a distinguished road
Default

It is the FileExists() function.

Here is a code sample from the help file to check if a file exists and then prompts for confirmation before deleting it:

Code:
if FileExists(FileName) then
  if MessageDlg('Do you really want to delete ' + ExtractFileName(FileName) + '?'), mtConfirmation, [mbYes, mbNo], 0, mbNo) = IDYes then 
    DeleteFile(FileName);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-06-2007, 06:27 AM
priorityone
Guest
 
Posts: n/a
Default

Use FileExists function. If file exists, then this function will return True.

procedure TForm1.Button1Click(Sender: TObject);
begin
if FileExists(Edit1.Text) then
ShowMessage('File already exists!')
else
ShowMessage('This file is unique');
end;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-07-2007, 01:54 AM
John's Avatar   
John John is online now
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Exclamation

Quote:
Originally Posted by priorityone View Post
Use FileExists function. If file exists, then this function will return True.

procedure TForm1.Button1Click(Sender: TObject);
begin
if FileExists(Edit1.Text) then
ShowMessage('File already exists!')
else
ShowMessage('This file is unique');
end;
We appreciate your help, but this issue was solved four months ago in the post above yours. Please try not to bring back dead topics as its not tolerated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Project: ionFiles - Joomla Simple File Download Jordan Community Projects 324 11-10-2008 08:34 PM
Windows XP Tricks & Tips!!!!..new ones. pranky Tutorials 9 08-23-2008 04:22 PM
Check if a file exists Lop C and C++ 4 08-07-2006 11:03 PM
Check if a File Exists NeedHelp C# Programming 4 08-07-2006 06:20 PM
Check if a URL Exists Chan PHP Forum 1 07-13-2006 01:54 PM


All times are GMT -5. The time now is 05:09 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads