Lost Password?

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

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

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, 12:07 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Credits: 112
Rep Power: 16
Lop 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, 09:56 PM
BuildPromoteWin's Avatar   
BuildPromoteWin BuildPromoteWin is offline
Newbie
 
Join Date: Jul 2006
Posts: 10
Credits: 0
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, 05:27 AM
priorityone
Guest
 
Posts: n/a
Credits: 0 [Check]
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, 12:54 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,238
Last Blog:
Passwords
Credits: 881
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
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

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


All times are GMT -5. The time now is 07:00 PM.

Contest Stats

Xav ........ 1333.07
MeTh0Dz|Reb0rn ........ 1055.7
John ........ 881.37
morefood2001 ........ 879.43
marwex89 ........ 869.98
WingedPanther ........ 851.68
Brandon W ........ 757.44
chili5 ........ 312.39
Steve.L ........ 247.05
dcs ........ 217.87

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 82%

Ads