DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: .exe to check for a file/folder existance and act accordingly  (Read 8,334 times)

sri

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 689
Hi all,

I am requesting for a tiny program (.exe) that would check for existance of a file/folder on the user's computer and prompt them for a download if they don't have it.

It should have the following input boxes:

1. Path of the file/folder to check (Ex.: C:\Program Files\AvaFind)

2. If present, the path to a file/folder to launch (Ex.: C:\%ProgramFiles%\blah\congrats.html)

3. If Not Present, path to a file/folder to launch (Ex.: c:\program files\internet explorer\iexplore.exe http://www.google.com/search?q=AvaFind)

If not a GUI, a file that can be edited by a text editor with the above modifiable parameters would work as well.

Thanks for any help.
« Last Edit: January 11, 2007, 09:04 AM by brotherS »

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: IDEA: .exe to check for a file/folder existance and act accordingly
« Reply #1 on: January 11, 2007, 11:11 AM »
Here's a small script i made for this:
.ahk version
.exe version
It's called CheckForFile and works with command line parameters:

Code
CheckForFile.exe [FileToFind] [RunIfFound] [RunIfNotFound]
[FileToFind] is the file you want to check for existence,
[RunIfFound] is the comand you'd like it to run in case it found the file (can be a file, an url, etc)
[RunIfNotFound] is the command you'd like it to run in case it didn't find the file.

sri

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 689
jgp,

Can you pls give me another version of the script which checks to see if the file is already running (open)?

i.e, check is to be done to see if a file is running and not to see if it exists.

Thanks.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Sure, that's easy. Only notice that it'll only work by the name of the process. It cannot detect if it's a specific file under a specific path.
It works in the exact same way as the other one, only that instead of passing it the path to the file, you pass it the name of the executable.

sri

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 689
Thanks for that but I was actually looking for a prog (.exe) that will check if a specific file (at the same location as the .exe) is open.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Oh, you mean like checking if a .doc file is open in word or something? I don't think i know how to do that :(

Brad

  • Participant
  • Joined in 2006
  • *
  • Posts: 4
Re: IDEA: .exe to check for a file/folder existance and act accordingly
« Reply #6 on: September 27, 2007, 06:06 AM »
Hello,

I have something similar that I wrote.

http://www.easyhr.com.au/software/easy_file_in_use.htm
Checks whether a file is in use.

http://www.easyhr.com.au/software/easy_is-it-there.htm
Checks to see if a directory exists and if it does, runs an EXE with parameters

Both work independantly.

Original address: https://www.donationcoder.com/forum/index.php?topic=6963.0