Jump to content


Photo

U.y.ftp V1.2 Update


  • This topic is locked This topic is locked
148 replies to this topic

#1 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 16 January 2004 - 06:18 PM

well i made an ftp dll called U.Y.ftp v1, i dont know why someone hasnt allready made one it wasent really too difficult to do unless they dident want to make one without a status indicator (i dont really get how that works, ill probly make a status indicator in a future release of this dll)

heres what U.Y.ftp v1 can do:
upload
download
renamefile on ftp
deletefile on ftp
deletedir on ftp
createdir on ftp
setworkingdir on ftp

and a few other ones that im probly forgetting


To download, go to: http://www.angelfire...ak2/censored4u/
Then, paste this to your address bar: http://www.angelfire.../U.Y.ftp_v1.zip


ps: something i just thought of: to give your passwords/usernames more protection from prying eyes, try encrypting them in a file and including that with your game. then read the file and decrypt it within gm that way your username/password shouldent be readable easyly i coulda done it but im too lazy plus i wanted people to be able to log in to the example server with the angelfire web shell to see that yes this dll does work.


also Richard if you read this could you put a link to U.Y.ftp v1 under my name in the pinned topic? thanks <_<
  • 0

#2 Sockets

Sockets

    GMC Member

  • New Member
  • 4 posts

Posted 16 January 2004 - 06:31 PM

Well done. Its your first DLL that is actually useful. <_<
  • 0

#3 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 16 January 2004 - 06:34 PM

syscolorz was usefull if you were making a sub os or whatever and the internal speaker one would have been more usefull if ms had never made windows xp.
  • 0

#4 Guest_juju1828_*

Guest_juju1828_*
  • Guests

Posted 17 January 2004 - 12:04 AM

One function you should make is the DIR function or have the DLL return a list on the the current files on the logged on server.

EDIT: Are you ever going to release the source code?

Edited by juju1828, 17 January 2004 - 12:04 AM.


#5 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 17 January 2004 - 03:05 AM

yeah i think a dir function to get a list would be good, its just that thats another thing thats kind of complex-- either that or i just think so because i have an old SDK and its not documented....

the main reason i dident release source is because the download function could very easyly modifyed be made to allow a "stealth" download that is a download that could download without the user knowing, save it to some obcure place on the hard drive, and then run it.

so anyway 2 things ill look into is getting a list of files/using a status bar for a next version if i get around to figureing those things out. glad ya tryed it :angry:
  • 0

#6 Yani

Yani

    GMC Member

  • New Member
  • 48 posts

Posted 18 January 2004 - 01:00 AM

I think you made a serious mistake when you decided to add the question dialog for the download function. There is another dll that works completely silent. What if I made a game that depends highly on internet. The player would get frustrated really quick if he gad to click ok all the time. It's up to the author how he uses your dll. It's ok if you don't want people to use your dll to damage someones computer, but this way hardly no one would use it in a game!
  • 0

#7 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 18 January 2004 - 01:28 AM

well a dll really shouldent have to download from the internet very often though (at least not in a well made gm game, in a very complex game maybey)... just for like updates or maybey get a highscore table now and then. ill change it though to get rid of the message box to make it download quietly if no one has anything against it.....
  • 0

#8 Flawed

Flawed

    GMC Member

  • New Member
  • 90 posts

Posted 22 January 2004 - 10:05 PM

I'm using this .dll to let people upload text files to my wesite, so I have to log in with my account name and password. The code I'm using looks like this:
server="name of server"
username="My account name"
password="mypassword"

Is this safe, or do you think I need to encrypt my info like you said above. If so do you have and example
  • 0

#9 PJ Games

PJ Games

    NUFC Rulz!

  • New Member
  • 38 posts

Posted 22 January 2004 - 10:21 PM

You should encrypt as it has to be written as a text file before upload, so it could be alterd. There are plenty of DLLs around to do that
EDIT : Sorry wrong thing, but you need to encrypt them as they are just variables in the RAM otherwise

Edited by PJ Games, 22 January 2004 - 10:23 PM.

  • 0

#10 Flawed

Flawed

    GMC Member

  • New Member
  • 90 posts

Posted 22 January 2004 - 10:39 PM

Thx, anyone have any examples...I could probably make one but it would be easy to crack..I need someone who knows what they're doing
  • 0

#11 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 22 January 2004 - 10:58 PM

well my idea was that you could encrypt your info and then save it as a variable, then decrypt it with your program. even if it turned "username", "password" into !@#$%&#@!@$@(@(()@$*@ or something it would be a ton safer no one who knows how to get the decription algoritim from your program isnt going to care about getting in your server for malicious reasons anyway... i spose i could try and come up with something tonight in gml if i have enough time (a lot of times gml takes me longer than c++ to do certain things because im so used to c++ now :blink: )
  • 0

#12 Guest_M2k3_*

Guest_M2k3_*
  • Guests

Posted 22 January 2004 - 11:13 PM

What exactley does FTP stand for?

#13 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 22 January 2004 - 11:16 PM

ftp stands for
File Transfer Protocol


its a wonder no one has asked what U.Y. stand for... unless everyone downloaded it and saw it in the readme :blink:
  • 0

#14 Flawed

Flawed

    GMC Member

  • New Member
  • 90 posts

Posted 23 January 2004 - 02:57 AM

I found an encryption example, and got my program working...thx for the help
  • 0

#15 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 23 January 2004 - 02:58 AM

could you post the example so people can use it too? change it from the version you used so it encrypts differently so your program is more secure. and remember the license you have to e mail me a link to your program when your done ::lmao::
  • 0

#16 Flawed

Flawed

    GMC Member

  • New Member
  • 90 posts

Posted 23 January 2004 - 03:51 AM

Here's a link to the topic about encryption:

CLICK HERE


As soon as I put it on my web site I'll send you a link. I'm not sure that I'm ready to realease it yet

It may take awhile. I'm working on some new features

Edited by Flawed, 23 January 2004 - 08:26 PM.

  • 0

#17 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 03 April 2004 - 05:32 PM

allright cause of all the complaints i have updated the dll to 1.2 and gotten rid of the confirmation messagebox before download, i have updated U.Y.ftp to allow for "stealth" downloads. the readme's are slightly updated and i would like users to re- read them and especialy pay attention to this part

so now
your programs can stealth download. but because of this be warned-
some antivirus companys dont take too well to stealth downloads.
please note that there is an older version of this dll that is slightly
larger and has a confirmation messagebox before a download at
http://www.angelfire...U.Y.ftp.v10.zip it would
be best if you used this one to make certain your program isnt
considered a virus by any antivirus people.

another upside to this update is the dll is now smaller. (not because of the messagebox- because i compiled it with debug info last time and i figured out how to get that out) so now the dll is about a third of the size it was with all the same functions, and the overall download of the dll package is around half the size (like 31k)

next few updates when i finaly get around to figureing them out: (no specific order)

dir function to get list of all files in directory
progress function -to get the progress of a download/upload
read a file directly from ftp without downloading it first
write a file directly on ftp without a need for upload

by the way since this was only a minor update, the dll link is the same, however there is now a link(up in the quote from the readme) in case anyone doesnt want there games to possibly be seen as possible viruses by antivirus companys.

Edited by ih8censorship, 03 April 2004 - 05:43 PM.

  • 0

#18 samnoon93

samnoon93

    samn00b93

  • New Member
  • 73 posts

Posted 07 April 2004 - 07:44 PM

I think I might use this DLL to make a free file hosting service like Microtech but with a limit on number of files and file size.
  • 0

#19 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 07 April 2004 - 08:54 PM

oh yeah? well its not an ftp server,its more like an ftp client without the more advanced things like progress bars, which i really should work on..... but good luck anyways ::lmao::
  • 0

#20 Guest_jammymacster_*

Guest_jammymacster_*
  • Guests

Posted 07 April 2004 - 09:57 PM

i think the download function will be useful for checking for updates and downloading updates.

It could download and read a file from your web space and check it to se if there are any updates then download the update from the address given in the file.

You need to be careful tho because trying to add updates to a game can mess it up if not done carefully

#21 RocketSoft84

RocketSoft84

    <---//{([X])}\\--->

  • New Member
  • 191 posts

Posted 17 May 2004 - 12:09 AM

syszcolors i use it alot it was very useful to me and this dll is even more useful its awsome
  • 0

#22 39ster

39ster

    GMC Member

  • GMC Member
  • 898 posts

Posted 17 May 2004 - 11:19 AM

yea need a function to return all the file/directory names.
Also can you make it so you can send ftp commands? e.g "del filename"

the main reason i dident release source is because the download function could very easyly modifyed be made to allow a "stealth" download that is a download that could download without the user knowing, save it to some obcure place on the hard drive, and then run it.

lol pathetic excuse.
1. Why would you care?
2. Its easier doing it in vb.

Edited by Luke Graham, 17 May 2004 - 11:26 AM.

  • 0

#23 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 17 May 2004 - 05:53 PM

RocketSoft84- im glad you like the dll's it does me good to know that someone actually uses them. ^_^

Luke Graham- ive been working on a way to get a listing of all the files now, but im at a sort of crossroad where i could make it easy to use , yet somewhat limited because it would only output into a default edit or listbox control, OR i could make it a little more complex and have the person using the dll handle output with the more advanced way.....hey i suppose i could do both.....dident think of that untill just now :P

and by sending ftp commands im not sure if i can do that on the level that i am working with ftp. what did you want to do on ftp that wasent in the dll allready? (besides the directory file listing) ill look into it though for ya

lol pathetic excuse.
1. Why would you care?
2. Its easier doing it in vb.

1. i get tired of people complaining. which is why i removed the messagebox confirming a download, and the dll can now "stealth download" the reason i dident have it originaly do that was because many anti-virus companys consider anything that downloads without a user knowing to be malware. see the readme2.txt for more details. but after i got so many complaints i figure ahh why not let em download how they want...
2. i dont care if its easyer to do in vb. up untill a while back there was nothing avalable to make a vb dll work with gm. and im not into vb/dont plan on it. so i really dont care if its easyer in vb :P B)

current todo:
-directly read/write to files on ftp server
-directory listing of some sort, will most likely be 1 default, easy, limited method and then another that is a little harder and more flexible.
-status bar. i dunno when ill finaly get that in... its confusin
-POSSIBLY seperate thread(s) to do things in so it cannot pause the gm game momentarily. havent had any complaints that i can think of about pausing it, but i know it does it to an extent.

yeah ill get back to working on this project more often after i finish my other project for the june 20th competition at the c++ learning community ^_^ so i guess just sit tight and have a root beer :)
  • 0

#24 39ster

39ster

    GMC Member

  • GMC Member
  • 898 posts

Posted 17 May 2004 - 11:26 PM

2. i dont care if its easyer to do in vb. up untill a while back there was nothing avalable to make a vb dll work with gm. and im not into vb/dont plan on it. so i really dont care if its easyer in vb -_-  B)

I mean its easier to do that invisible web downloader thing in vb (not talking bout dlls or game maker)

Once you figure out how to recieve directory/file names you could make it like set the filename string to an array e.g
variables:
numberoffiles = (whatever the dll returns for how much files are in the directory.)
numberofdirectories = (whatever the dll returns for how much sub-directories are in the directory.)

file[0] = (first file)
file[1] = (2nd file)
ect...
dir[0] = (first sub directory)
dir[1] = (2nd sub directory).
ect..

Edited by Luke Graham, 17 May 2004 - 11:33 PM.

  • 0

#25 Scrappersa

Scrappersa

    GMC Member

  • New Member
  • 9 posts

Posted 17 May 2004 - 11:53 PM

Awesome! One suggestion, connecting in passive mode. I can't connect to my server =/.
  • 0

#26 Lep

Lep

    SupremeVision

  • New Member
  • 16 posts
  • Version:Unknown

Posted 17 May 2004 - 11:57 PM

If someone really wanted your FTP password and username, they could run a packet sniffer.

Edit: Fixed after 753 days. Damn you hands!

Edited by Lep, 10 June 2006 - 02:15 AM.

  • 0
No!

#27 deathrabbit

deathrabbit

    GMC Member

  • New Member
  • 19 posts

Posted 09 June 2004 - 01:23 AM

i tried the example that came with the dll and when i click play, it comes up with "error defing external function". what am i doining wrong? ^_^
  • 0

#28 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 09 June 2004 - 02:11 AM

are you a registered gamemaker user? if not then its because unregistered users cant use dlls. what version of gamemaker do you have if you are registered?

whats passive mode?

also for anyone who cares ive started on what may become 2.0
  • 0

#29 1800askgeek

1800askgeek

    GMC Member

  • New Member
  • 350 posts

Posted 09 June 2004 - 08:03 AM

I haven't gotten to mess around with it yet, but this is another great idea. Between this FTP dll, the GMSock dll, and the GmSql dll this place will be fully "internet-ized". The world is really looking up now. BTW: has anyone considered:

Use the FTP dll with a free host, say, Tripod, to upload "updates" to a MMORPG type game, and then use GmSql to work with the "interaction" stuff of the program? And GMSock if there is anything else u need to do that these 2 won't do 4 u. I think entire world is starting to get into the information age now... When 15 year old kids like me can start writting their own MMORPGs, etc, there is no telling what will be comming up next. Now that I'm starting to rant, I'll stop before I drive everyone crazy...
  • 0

#30 deathrabbit

deathrabbit

    GMC Member

  • New Member
  • 19 posts

Posted 09 June 2004 - 07:53 PM

I use v5.0 because u dont have to be registered to use internet functions

if i can get this to work, a good command i would like to see for U.Y.ftp 2.0 would be to change data in a file without having to download and them upload because if u had bad upload and download timing in the current version, like if p1 download the file and and then p2 downloads and then p1 uploads a modified file and then p2 uploads other modified file, data could be lost(in the example, p1's changes would not be shown)
  • 0

#31 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 09 June 2004 - 08:14 PM

a good command i would like to see for U.Y.ftp 2.0 would be to change data in a file without having to download and them upload

yep ive actually allready got those directly read/write functions coded into what will (eventually) be the new version.

i dunno what your doing wrong if your using 5.0.... works fine for me and thats what i use.
  • 0

#32 deathrabbit

deathrabbit

    GMC Member

  • New Member
  • 19 posts

Posted 09 June 2004 - 11:22 PM

i got it to work. i originally had the dll in the folder with the gm files instead of the folder with the gmd in it.
thanks for trying to help anyway :lol:
  • 0

#33 deathrabbit

deathrabbit

    GMC Member

  • New Member
  • 19 posts

Posted 11 June 2004 - 09:22 PM

how will u use the new direct read/write functions? in a game i want 2 make, i need to be able 2 be able 2 open a txt file on the ftp server change about 20 characters of text, which the program will know both line numbers and what number characters to change and close it without any other downloads or modifications to take place until it is closed. Will the the new direct read/write functions allow this? :D
  • 0

#34 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 11 June 2004 - 09:46 PM

they dont yet its just basic read/write but if you think that could be usefull i could probly work something similar to that :D

Edited by ih8censorship, 11 June 2004 - 09:54 PM.

  • 0

#35 DtD

DtD

    Owner of DtD Software

  • New Member
  • 207 posts

Posted 11 June 2004 - 10:45 PM

The link didn't work it just gave me an error tht said:

Angelfire does not allow direct linking
from offsite, non-Angelfire pages,
to files hosted on Angelfire.


--DtD B) :lol: B)

Please I really need this.
  • 0

#36 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 11 June 2004 - 11:25 PM

did you try right clicking the link and then click save as?
  • 0

#37 bd13

bd13

    GMC Member

  • New Member
  • 37 posts

Posted 12 June 2004 - 02:51 PM

I just want to say that i think this dll is great! and that i'm looking forward to the viewing directory part, when it comes out. i think i'm going to use this to upload custom level files, that you can make in my game, to a free hoster like tripod, i already tested this so it works, and then using the other functions you'll be abile to browse the list of files and d-load any levels avalible on the online data base. i and thinking to overcome the viewing directory thing, until that function comes out, i will have any uploades write their filename to a text file, that way all you have to do is d-load an index file that list all the files present in the directory. great dll!
  • 0

#38 DtD

DtD

    Owner of DtD Software

  • New Member
  • 207 posts

Posted 12 June 2004 - 10:48 PM

Ya I tried right clicking and save target as..

--DtD B)

--Tryed Again,Now I Downloaded it.

Edited by DtD, 16 June 2004 - 09:42 PM.

  • 0

#39 bd13

bd13

    GMC Member

  • New Member
  • 37 posts

Posted 15 June 2004 - 08:38 PM

hey ih8censorship,
can you clarify the directory switching a little more? i can get the dll to switch up a directory but how do you go back to the previous one? so i guess all i'm asking is how to set up the "strings" used to switch directories.
  • 0

#40 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 15 June 2004 - 09:04 PM

well i guess i never thought of that... but id say if your in root and you want to go to root/stuff then you switch it to stuff and then maybey switch back to root? what all have you tried?
  • 0

#41 bd13

bd13

    GMC Member

  • New Member
  • 37 posts

Posted 15 June 2004 - 09:47 PM

actually i got it to work, what i found is if you begin everything with "/" then you can switch between any directories easly. so if your base directory contains the folders: "uno" "dos" and "cheese" then all you type in is "/uno/" to go to the "uno" directory. but if you now want to go to the "cheese" directory (which means you go down then up in the directory system) all you have to type in is "/cheese/" Its like your always starting with the base directory so everything works ok. but, and i haven't tried this, if you just want to go back to the base directory then i guess you could just type in '', a nothing string, or '/'. i think, logically, this would work.
  • 0

#42 deathrabbit

deathrabbit

    GMC Member

  • New Member
  • 19 posts

Posted 16 June 2004 - 09:24 PM

maybe u could go down a level by using .. like in dos if u want 2 go down a directory u use cd .. or cd /.. or cd ../ or cd /../ or using chdir instead of cd depending on the version of dos(some of those will work, but im not an expert)

what i would like 2 see 4 direct read/write functions that would help me in a game i would like 2 make is a direct read/write that blocks off other users axess 2 the file and returns a specific error if someone else is changing it or puts u in a "line" to use the file 4 when it is closed

basicly, im looking 4 something that could be used in 1 of these 2 ways(preferably the 2nd)

FtpInit(ftpserver,username,password);
do
{
  result=ChangeFileOnServer(filename);  //can return anynumbers but 4 this
  //example im using  1=sucess   0=cant open    2=cant open because it is already
  //open but 4 someone else
  //function opens the file2 directly write in file on server
}while(result!=2)
if(result==0)
{
  exit();
}
ChangeChar(line_number, character_position);
// on  last line 4 char position, 1would be "C" 2 would be "h" ect.
// repeat as many times as nessisary
CloseFileOpenOnServer();

or this would work(this one is probably better)

FtpInit(ftpserver,username,password);
result=ChangeFileOnServer(filename);  // returns any numbers but for this 
//example im using 1=sucess 0=falier
// if file is already in use by another person, game waits until file is closed then 
//returns 1
ChangeChar(line_number, character_position);
//repeat as needed
CloseFileOpenOnServer();
//closes 4 next person

also it would be nice, but not nessisary 2 have an automatic close file in case something happens with someones comp(crash, freeze, ect.)wile they have the file open so other people dont wait indefinatly for the file 2 close

please make these functions 4 the next version and i will use them and u will get credited everywhere that i get credited in a game i make with them

the most important part of these functions(2me) is the fact that others cant read or write until the file is closed on the server
  • 0

#43 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 17 June 2004 - 12:18 AM

well ill do the best i can, but i think that because of some limitations in the ftp protocol itself, that the best i could do is probly "put someone in line" to write to the file. well we'll see, ive been working on this dll more as i have said but i have 1 more project that i kinda gotta get done in a hurry.... so maybey after sunday or monday ill get really chuggin away at this dll more (i allready added about 5 functions though, but i gotta see if they work/ do docs /add more stuff ect ect.)
  • 0

#44 bd13

bd13

    GMC Member

  • New Member
  • 37 posts

Posted 17 June 2004 - 12:29 AM

one more thing to tell you, ih8censorship, if you try and connect to the server/ftp address and you don't have an internet connection or for some reason it won't connect then the dll, or GM, will display a message saying something like: "failed to...(do something reguarding the dll)" and then the game itself will display the show_message thing that you've added incase the connection failed. so what i get are two messages, one looks like the type you get when code doesn't make sence, and another that is the defualt message that is built into GM. just thought you'd want to look into this, if you didn't already know about it.
  • 0

#45 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 17 June 2004 - 12:49 AM

allright it makes sense that its doing that, i guess i put those there so no one could say that the dll dident work just because they dident know they werent connected to the net and also for my testing because i wanted to know if it was my code that wasent working or the ftp server of my internet connection or whatever. HOWEVER if you think it would be helpfull to you, and the rest of the gamemaker community i could make it so you, the user of the dll - could set it not to show errors at all or to show errors if they arise. would that be better? the dll would no longer be totaly backwards compatible then, but hey if you think it would be better than why not :(
  • 0

#46 bd13

bd13

    GMC Member

  • New Member
  • 37 posts

Posted 17 June 2004 - 02:19 AM

i think that would be a good option, that way you could incorporate the dll into your game and totally custom it to fit your needs.

another thing you could, and i stress 'could', think about changing is the prompt thing you have when d-loading a file. i never have really seen it because i have another dll that i use to do what you could call 'stealth d-loads', but that is only because what needs to be d-loaded the user has already agreed to and some things i don't always want a pop-up d-load prompt to come up, might get on people's nerves. don't get me wrong i know why your doing it, but for the honest people that prompt might get annoying. and, note remember i haven't tested this function yet, if the prompt gives away the url of the file then you might get some people hacking or simply trying to mess with the file(s) now that they know where they are, that was a main concern of mine with what i'm using it for (i think i explained on a previous post). i'm just telling you what i think, it's your dll so you get to do what you want. no matter what, i think, as well as many others, that this is one cool kick @$$ dll you got going, i can't wait for those new functions and what not...but be sure to include the "view all files in a directory" function... :huh: i really need that or else i got problems. :P
  • 0

#47 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 17 June 2004 - 02:45 AM

allright ill get to that next time i work on the dll then :)

theres no confirmation box when downloading anymore. i got too many complaints. i was thinking of making it an optional thing though in version 2 so you could decide wheather or not you wanted to make sure the user knew before downloading (ya have to be carefull because several av companys consider anything that downloads without the user knowing to be virus type programs, but people here dont seem to know that oh well.)
  • 0

#48 bd13

bd13

    GMC Member

  • New Member
  • 37 posts

Posted 17 June 2004 - 02:06 PM

ah, ok, thanks for that .... and it even says it in the readme, i just didn't read that far down.

(srry about all these q's, if they r annoying you and all, but i got one more):
does the d-load function check to see wether or not the d-load was successful or not? just wondering, thanks
  • 0

#49 ih8censorship

ih8censorship

    GMC Member

  • New Member
  • 165 posts

Posted 17 June 2004 - 04:40 PM

nah your not being annoying :) the download function doesnt return if it was successfull or not i guess i was being lazy/relying on the person using the dll to worry about that.... well my todo list is getting bigger but thats ok it means ill have no trouble calling version 2.0 -2.0
  • 0

#50 Guest_juju1828_*

Guest_juju1828_*
  • Guests

Posted 17 June 2004 - 06:09 PM

You can check whether the download was successful by just using the file_exists command in an if statment and you have the check. :D