Jump to content

Recommended Posts

Hey there,

 

Thanks for taking the time to read, I'm a beginner PHP Coder, I would like to know how to create a PHP script that every time you run it, It will create a filename with +1 number each time For example:

 

 

  • 1st Time running the script: Creates directory "/home/servers/server100"
  • 2nd Time running the script: Creates directory "/home/servers/server101"
  • 3rd Time running the script: Creates directory "/home/servers/server102"
  • 4th Time running the script: Creates directory "/home/servers/server103"

 

And it keeps adding +1 to the file name like that each time, How could i do this?, Thats for the help, P.S i would need to execute this VIA SSH2.

 

Link to comment
https://forums.phpfreaks.com/topic/175676-help-with-file/
Share on other sites

pretty much your entire solution will revolve around this function

http://us2.php.net/file_exists

 

you may even possibly find a copy and paste answer in the comments area

 

 

EDIT: If not that function, then this one will be it http://us2.php.net/manual/en/function.is-dir.php

Link to comment
https://forums.phpfreaks.com/topic/175676-help-with-file/#findComment-925771
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.