RE: [PHP-GENERAL] copying files
| From: | Ken N | Date: | Tue, 27 Jun 2000 14:20:01 +0000 |
| Subject: | RE: [PHP-GENERAL] copying files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3385@lists.php.net to get a copy of this message | ||
Here is the output of what your code does. whcich eesentially the same as
min, however for the record I cut and pasted yours.
My question is if it cannot open the file for reading, why then can it
tell me the name of the file? This is what has me so confused.
Thanks
Ken N
//---------------------------------------------
I am going to move test.com into roy3
Warning: MkDir failed (File exists) in
/web/sites/roy20/lapidary.com/stats-new/test-modify.php3 on line 20
Unable to create directory
file: index.php3
newdir: roy3
domain: test.com
Warning: Unable to open 'index.php3' for reading: No such file or
directory in /web/sites/roy20/lapidary.com/stats-new/test-modify.php3 on
line 28
Error copying file index.php3
file: index1.php3
newdir: roy3
domain: test.com
Warning: Unable to open 'index1.php3' for reading: No such file or
directory in /web/sites/roy20/lapidary.com/stats-new/test-modify.php3 on
line 28
Error copying file index1.php3
file: index2.php3
newdir: roy3
domain: test.com
Warning: Unable to open 'index2.php3' for reading: No such file or
directory in /web/sites/roy20/lapidary.com/stats-new/test-modify.php3 on
line 28
Error copying file index2.php3
//----------------------------------------------------------
http://cleveland.lug.net/~rocket/
The answer is simple if you grant that ironies are like submarines;
dangerous only when submerged.
On Mon, 26 Jun 2000, Jason wrote:
> Use echo statements to output the values of the variables so we can debug it
> like this:
> <?php
> echo("<B>" . "I am going to move $domain into
> $newdir"."</B>");
> if (!mkdir("$newdir/$domain", 0770))
> echo "Unable to create directory<br>";
> $directory = opendir("$dir/$domain");
> while ($file = readdir($directory))
> {
> if(($file != ".") && ($file != ".."))
> {
> echo "file: $file <br> newdir: $newdir <br> domain: $domain
> <br>";
> if (!copy($file, "$newdir/$domain/" . $file))
> echo "Error copying file $file<br>";
> else
> echo "<B> I moved $file into $newdir/$domain</B><BR>";
> }
> }
> ?>
>
> That way we can see exactly where the problems is.
>
> Jason
>
> > -----Original Message-----
> > From: Ken N [mailto:kenn@pcintelligent.com]
> > Sent: Monday, June 26, 2000 10:26 AM
> > To: Jason
> > Cc: php-general@lists.php.net
> > Subject: RE: [PHP-GENERAL] copying files
> >
> >
> > I am not sure what you mean? you mean the listing of the directory?
> > Sorry
> >
> > http://cleveland.lug.net/~rocket/
> >
> > The answer is simple if you grant that ironies are like submarines;
> > dangerous only when submerged.
> >
> >
> > On Mon, 26 Jun 2000, Jason wrote:
> >
> > > Do an output of the value of all your variables and post that.
> > >
> > > Jason
> > >
> > > > -----Original Message-----
> > > > From: Ken N [mailto:kenn@pcintelligent.com]
> > > > Sent: Monday, June 26, 2000 10:00 AM
> > > > To: Jason
> > > > Cc: php-general@lists.php.net
> > > > Subject: RE: [PHP-GENERAL] copying files
> > > >
> > > >
> > > > I tried that. I also tried just copying the file to /tmp, there is
> > > > somehting really wrong here and I have no idea what.
> > > >
> > > > Ken N
> > > >
> > > > http://cleveland.lug.net/~rocket/
> > > >
> > > > The answer is simple if you grant that ironies are like submarines;
> > > > dangerous only when submerged.
> > > >
> > > >
> > > > On Mon, 26 Jun 2000, Jason wrote:
> > > >
> > > > > If you can't copy it to /tmp, it probably isn't a permissions
> > > > issue like you
> > > > > said.
> > > > >
> > > > > Try this and see if it works...
> > > > > <?php
> > > > > echo("<B>" . "I am going to move $domain into
> > > > > /tmp"
> > . "</B>");
> > > > > mkdir("/tmp/$domain", 0770);
> > > > > $directory = opendir("$dir/$domain");
> > > > >
> > > > > while ($file = readdir($directory))
> > > > > {
> > > > > if(($file != ".") && ($file != ".."))
> > > > > {
> > > > > copy($file, "/tmp/$domain/$file");
> > > > > echo("<B>" . "I moved $file into
> > > > /tmp/$domain" . "</B>" . "<BR>");
> > > > > }
> > > > > }
> > > > > ?>
> > > > >
> > > > > Jason
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Ken N [mailto:kenn@pcintelligent.com]
> > > > > > Sent: Monday, June 26, 2000 9:23 AM
> > > > > > To: Jason
> > > > > > Cc: php-general@lists.php.net
> > > > > > Subject: RE: [PHP-GENERAL] copying files
> > > > > >
> > > > > >
> > > > > > Nope, that doesn't work either. it's not a permissions issue
> > > > as I can su
> > > > > > to the user the web server runs as and do everything I am
> > trying to do
> > > > > > with this script. I am really frustrated by this as I have no
> > > > idea what
> > > > > > the problem is?
> > > > > >
> > > > > > Thanks
> > > > > > Ken N
> > > > > >
> > > > > > http://cleveland.lug.net/~rocket/
> > > > > >
> > > > > > The answer is simple if you grant that ironies are like
> > submarines;
> > > > > > dangerous only when submerged.
> > > > > >
> > > > > >
> > > > > > On Mon, 26 Jun 2000, Jason wrote:
> > > > > >
> > > > > > > Try copying the file to /tmp and see if it will let you do
> > > > > > that. If it will
> > > > > > > then it's a permissions issue.
> > > > > > >
> > > > > > > Jason
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Ken N [mailto:kenn@pcintelligent.com]
> > > > > > > > Sent: Monday, June 26, 2000 9:07 AM
> > > > > > > > To: Jason
> > > > > > > > Cc: php-general@lists.php.net
> > > > > > > > Subject: RE: [PHP-GENERAL] copying files
> > > > > > > >
> > > > > > > >
> > > > > > > > Thanks for the help but that didn't seem to do the
> > > > > > > > trick.
> > > > I always get
> > > > > > > >
> > > > > > > > Warning: Unable to open 'index1.php3' for reading:
> > > > > > > > No
> > such file or
> > > > > > > > directory in ....
> > > > > > > >
> > > > > > > > If it can see the file and print out the name once it
> > > > gets a directory
> > > > > > > > structure. Why can it not copy it?
> > > > > > > >
> > > > > > > > Thanks
> > > > > > > > Ken N
> > > > > > > >
> > > > > > > >
> > > > > > > > http://cleveland.lug.net/~rocket/
> > > > > > > >
> > > > > > > > The answer is simple if you grant that ironies are like
> > > > submarines;
> > > > > > > > dangerous only when submerged.
> > > > > > > >
> > > > > > > >
> > > > > > > > On Mon, 26 Jun 2000, Jason wrote:
> > > > > > > >
> > > > > > > > > Try one of these:
> > > > > > > > > copy($file, "$newdir/$domain/".$file);
> > > > > > > > > copy($file,
> > > > > > > > > $newdir."/".$domain."/".$file);
> > > > > > > > > copy($file, "$newdir/$domain/$file");
> > > > > > > > >
> > > > > > > > > The latter is probably better. I don't think you
> > > > > > > > > can have
> > > > > > > > spaces when you
> > > > > > > > > use the string concatenation operator.
> > > > > > > > >
> > > > > > > > > Jason
> > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Ken N [mailto:kenn@pcintelligent.com]
> > > > > > > > > > Sent: Monday, June 26, 2000 8:58 AM
> > > > > > > > > > To: php-general@lists.php.net
> > > > > > > > > > Subject: [PHP-GENERAL] copying files
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Hi,
> > > > > > > > > > I have this little piece of code that seems to
> > > > > > > > > > work
> > > > > > fine except it
> > > > > > > > > > doesn't copy the file. Other than that I know
> > > > > > > > > > it's getting
> > > > > > > > the filenames
> > > > > > > > > > cause it prints the, out and it's not have
> > trouble creating
> > > > > > > > the directory
> > > > > > > > > > either. any suggestions?
> > > > > > > > > >
> > > > > > > > > > Thanks
> > > > > > > > > > //=========================================
> > > > > > > > > > <?php
> > > > > > > > > > echo("<B>" . "I am going
> > > > > > > > > > to move $domain into $newdir"
> > > > > > . "</B>");
> > > > > > > > > > mkdir("$newdir/$domain", 0770);
> > > > > > > > > > $directory = opendir("$dir/$domain");
> > > > > > > > > >
> > > > > > > > > > while ($file = readdir($directory))
> > > > > > > > > > {
> > > > > > > > > > if(($file != ".") && ($file
> > > > > > > > > > != ".."))
> > > > > > > > > > {
> > > > > > > > > > copy($file, "$newdir/$domain/" .
> > > > > > > > > > $file);
> > > > > > > > > >
> > > > > > > > > > echo("<B>" . "I moved
> > > > > > > > > > $file into $newdir/$domain" .
> > > > > > > > "</B>" . "<BR>");
> > > > > > > > > > }
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > http://cleveland.lug.net/~rocket/
> > > > > > > > > >
> > > > > > > > > > The answer is simple if you grant that ironies are
> > > > > > > > > > like
> > > > > > submarines;
> > > > > > > > > > dangerous only when submerged.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > > > > To unsubscribe, e-mail:
> > php-general-unsubscribe@lists.php.net
> > > > > > > > > > For additional commands, e-mail:
> > > > php-general-help@lists.php.net
> > > > > > > > > > To contact the list administrators, e-mail:
> > > > > > > > php-list-admin@lists.php.net
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > _______________________________________________________
> > > > > > > > > Site Design, Hosting, and E-Commerce at www.webpipe.net
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > > > To unsubscribe, e-mail:
> > php-general-unsubscribe@lists.php.net
> > > > > > > > > For additional commands, e-mail:
> > php-general-help@lists.php.net
> > > > > > > > > To contact the list administrators, e-mail:
> > > > > > php-list-admin@lists.php.net
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > > To unsubscribe, e-mail:
> > > > > > > > php-general-unsubscribe@lists.php.net
> > > > > > > > For additional commands, e-mail:
> > php-general-help@lists.php.net
> > > > > > > > To contact the list administrators, e-mail:
> > > > > > php-list-admin@lists.php.net
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > _______________________________________________________
> > > > > > > Site Design, Hosting, and E-Commerce at www.webpipe.net
> > > > > > >
> > > > > > > --
> > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > > > > > For additional commands, e-mail: php-general-help@lists.php.net
> > > > > > > To contact the list administrators, e-mail:
> > > > php-list-admin@lists.php.net
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > > > > For additional commands, e-mail: php-general-help@lists.php.net
> > > > > > To contact the list administrators, e-mail:
> > > > php-list-admin@lists.php.net
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > _______________________________________________________
> > > > > Site Design, Hosting, and E-Commerce at www.webpipe.net
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > > > For additional commands, e-mail: php-general-help@lists.php.net
> > > > > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> > > > >
> > > >
> > > >
> > >
> > >
> > > _______________________________________________________
> > > Site Design, Hosting, and E-Commerce at www.webpipe.net
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
> _______________________________________________________
> Site Design, Hosting, and E-Commerce at www.webpipe.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>