vote 2 for:
mv dir1/* dir2
:) backticks!
Per Jessen wrote:
Pastor Steve wrote:
I have been looking, but the problem is that I don¹t know what
questions to ask or what to look for. I think it is a rename function.
That works, but it only does one file at a time. I was looking for
something
On Jan 26, 2008 3:52 AM, Nathan Rixham [EMAIL PROTECTED] wrote:
vote 2 for:
mv dir1/* dir2
its nice, but its platform dependent.
-nathan
Nathan Nobbe wrote:
On Jan 26, 2008 3:52 AM, Nathan Rixham [EMAIL PROTECTED] wrote:
vote 2 for:
mv dir1/* dir2
its nice, but its platform dependent.
Which surely is not that much of a drawback? (well, the OP didn't
mention it anyway).
/Per Jessen, Zürich
--
PHP General Mailing
Pastor Steve wrote:
I have been looking, but the problem is that I don¹t know what
questions to ask or what to look for. I think it is a rename function.
That works, but it only does one file at a time. I was looking for
something that will do all the files in the directory without needing
I have been looking, but the problem is that I don¹t know what questions to
ask or what to look for. I think it is a rename function. That works, but it
only does one file at a time. I was looking for something that will do all
the files in the directory without needing to know the name of each
On Jan 24, 2008 3:51 PM, Pastor Steve [EMAIL PROTECTED] wrote:
I have been looking, but the problem is that I don¹t know what questions
to
ask or what to look for. I think it is a rename function. That works, but
it
only does one file at a time. I was looking for something that will do all
here a simple little cli script that has the guts of what youre
trying to accomplish.
NOTE: this is not a comprehensive solution :)
?php
$srcDir = $argv[1];
$destDir = $argv[2];
if(is_dir($srcDir) is_dir($destDir)) {
$dirHandle = opendir($srcDir);
while($curFile = readdir($dirHandle)) {
First get an array of all the files, e.g.,
$fpDir is the full path to yiour dir.
foreach(glob($fpDir*.*) as $file)
{
$filesArray[] = $file;
}
print_r($filesArray); //so you can see what's happening
Then do a:
foreach($filesArray as $file){
rename($sourceDir.$file,
On Thu, 2008-01-24 at 16:18 -0500, Al wrote:
First get an array of all the files, e.g.,
That's useful for debugging, but once you know what you're doing, it's a
waste of resources to accumulate the array unless you have a good reason
for doing so :)
Cheers,
Rob.
--
http://ca3.php.net/manual/en/function.copy.php
make the manual your friend
bastien Date: Thu, 24 Jan 2008 14:36:55 -0600 From: [EMAIL PROTECTED] To:
php-general@lists.php.net Subject: [PHP] Rename Does anyone know if there
is a way to move all the files in one directory into another?
On Jan 24, 2008 4:42 PM, Bastien Koert [EMAIL PROTECTED] wrote:
http://ca3.php.net/manual/en/function.copy.php
make the manual your friend
rename() is much more efficient; since the original files will
have to be deleted as well, with a copy approach.
and i suspect rename() atomic as well.
You obviously missed my last sentence. Once you get this working, you can put
the rename() in the first foreach() loop. Don't forget to take care of
exceptions.
Robert Cummings wrote:
On Thu, 2008-01-24 at 16:18 -0500, Al wrote:
First get an array of all the files, e.g.,
That's useful
On Thu, 2008-01-24 at 18:05 -0500, Al wrote:
You obviously missed my last sentence. Once you get this working, you can
put
the rename() in the first foreach() loop. Don't forget to take care of
exceptions.
Yep, sorry :)
Cheers,
Rob.
--
Both versions are PHP 5.2.4_p20070914-r2
I backchecked the rights a couple of times. There to problem
does not appear.
I cant really understand what is happening. On the server
eaccelerator and memcache is performing its work. I believe
that when I restart the apache and as well the memcache all
On Friday 19 October 2007 12:49:50 Sascha Braun | CEO @ BRAUN Networks wrote:
Hi everyone,
I am using the rename function on my local development
system fine. But as soon as I upload the script, the
rename function does not work anymore.
Is there a specific compiler flag needed, to make
Sascha Braun | CEO @ BRAUN Networks wrote:
I am using the rename function on my local development
system fine. But as soon as I upload the script, the
rename function does not work anymore.
Is there a specific compiler flag needed, to make rename
work on both plattforms?
You're using
On 10 August 2005 22:19, Richard Lynch wrote:
You can also, in some versions, get away with having \
inside of so
long as the following character isn't special:
$string = C:\homedirectory\uploadedfiles\\newfile.gif;
Note that the 'n' character is special (newline) but 'h' and 'u' are
not
On Tue, August 9, 2005 6:16 am, Stut wrote:
Colons (:) are not allowed in Windows filenames.
Of course they aren't allowed in file NAMES -- Because they are an
integral part of a drive letter designation such as C: which is what is
being used here.
There's nothing wrong with the C: part of the
Bosky, Dave wrote:
I seem to be having some trouble renaming a file after uploading it.
It always returns a warning message indicating I have an invalid
attribute in my rename statement.
snip
$old = 'C:\\homedirectory\uploadedfiles\\newfile.gif';
$new =
On Sat, June 18, 2005 3:50 am, Mister Jack said:
I would like to know precisely what rename do in case of error. any
link for that ?
It will probably return 0 (or maybe -1) on error.
It may or may not also fill in $php_errmessage (?) or whatever the
variable is called.
It should be documented
I have this magical script which uses rename. A visitor to the site
uploads a file and I want to rename it to a timestamp. Oddly enough,
the rename() function actually works, it renames the file AND then
generates a level 2 warning:
Error code: 2
Error message: rename() failed (No such
Lowell Allen wrote:
Try using $HTTP_POST_FILES['uploadedFile']['name'] instead. I wasted a bunch
of time yesterday with an upload script that did not recognize files when
using $_FILES, but worked fine with $HTTP_POST_FILES -- PHP 4.3.4 on
Linux.
Thank you for the suggestion. Unfortunately, it
Lowell Allen wrote:
Try using $HTTP_POST_FILES['uploadedFile']['name'] instead. I wasted a bunch
of time yesterday with an upload script that did not recognize files when
using $_FILES, but worked fine with $HTTP_POST_FILES -- PHP 4.3.4 on
Linux.
Thank you for the suggestion.
Grant Rutherford wrote:
Alternatively, is there some way that I could generate that file,
redirect the user to it, and then delete the file again afterwards? I
know how to do all of this except delete the file. Is there some way to
schedule a command to be run after the script is finished?
From: Grant Rutherford [EMAIL PROTECTED]
I have tried many variations of the header command, but no luck so far.
It seems to work okay on Mozilla browsers but not IE.
Okay, what have you actually tried? What are you using now? Have you read
through _all_ of the comments on the manual page for
Thanks for your response,
What I tried was the following:
header(Content-type: text/plain);
header(Content-Disposition: attachment; filename=\textfile.txt\);
echo $output;
This works properly on Mozilla, however the following problems occur in IE:
IE version 5.50.4522.1800 - 2 dialog boxes
I'm trying to rename some variables.
first I have a function -
randomize (3,4); //has created unique $numbers
then I want to create a function for the renaming:
renameit($sculp); //sends $sculp for the new variable name
and this function (and variations)
function renameit($var){
$z =
Global works...
- Original Message -
From: Jennifer Goodie [EMAIL PROTECTED]
To: Boyd Pearson [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 3:44 PM
Subject: RE: [PHP] rename variables
I'm trying to rename some variables.
first I have a function
From: Edward Peloke [EMAIL PROTECTED]
This is probably an easy question
Yep.. ;)
I have an uploaded image in a temp file that I want to rename and put in
another folder. I am using rename() which works fine, the problem is, I
want to force an overwrite if the file already exists. [snip]
PROTECTED]
Sent: Thursday, September 11, 2003 3:19 PM
To: Edward Peloke; [EMAIL PROTECTED] Php. Net
Subject: Re: [PHP] rename()
From: Edward Peloke [EMAIL PROTECTED]
This is probably an easy question
Yep.. ;)
I have an uploaded image in a temp file that I want to rename and put in
another
On Friday 31 January 2003 16:52, $B%X!<%s(B $B%H!<%^%9(B wrote:
(B when i try to rename a file with single quote(s) in the
(B file name, e.g.
(B
(B rename("/tmp/foo 'n bar", "/tmp/foobar");
(B
(B rename fails with "there is no such file".
(B whats wrong?
(B
(BYou probably need to
At 09:52 31.01.2003, =?ISO-2022-JP?B?GyRCJVghPCVzGyhCIBskQiVIITwlXiU5GyhC?=
said:
[snip]
when i try to rename a file with single quote(s) in the
file name, e.g.
rename(/tmp/foo 'n bar, /tmp/foobar);
rename fails with there is no such file.
whats wrong?
On Wednesday 11 December 2002 17:30, Steve Jackson wrote:
I'm trying to rename an uploaded file with the value of a select I have
in the uploaded form. Can someone point me in the right direction. The
PHP.net rename manual isn't helping a lot? My code:
What is the problem?
On Wednesday 11 December 2002 17:30, Steve Jackson wrote:
I'm trying to rename an uploaded file with the value of a select I
have in the uploaded form. Can someone point me in the right
direction. The PHP.net rename manual isn't helping a lot? My code:
What is the problem?
I can't
On Wednesday 11 December 2002 18:55, Steve Jackson wrote:
On Wednesday 11 December 2002 17:30, Steve Jackson wrote:
I'm trying to rename an uploaded file with the value of a select I
have in the uploaded form. Can someone point me in the right
direction. The PHP.net rename manual isn't
$_FILES['userfile']['name']
$_FILES['userfile']['type']
$_FILES['userfile']['size']
$_FILES['userfile']['tmp_name']
First once you upload file from browser using form ...input type=file
name=userfile, the filename is automatically renamed by another one and put
down to the upload_tmp_dir and
I am trying to allow the user to upload pictures. What is the best
way to
rename them? If I use the rename function, I have to upload the
pictures
to
the same place as the script and then move it. ALso, if I am not sure
of
the extension, how can I simply rename it? Can I do multiple files
Hi Martin,
Question: who actually OWNS the document? Does it have your logname and
group? If you're trying to do a rename from the server, remember that the
server generally runs as apache or nobody... and to coin a phrase,
nobody owns nothing.
If you're trying to manipulate files in your
on unix I think it should work for both.. can't say I know on windows..
also, why not try exec or system and just run the normal system command for
it?
- Original Message -
From: Jeff [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 24, 2001 6:07 PM
Subject: [PHP] rename a
Yes, rename() does work on Windows as well as on *nix.
-Original Message-
From: Tom Carter [mailto:[EMAIL PROTECTED]]
Sent: 24 July 2001 17:54
To: [EMAIL PROTECTED]; Jeff
Subject: Re: [PHP] rename a directory
on unix I think it should work for both.. can't say I know on windows..
also
Thanks! Next time I won't assume it won't work...
Jeff
Tom Carter wrote:
on unix I think it should work for both.. can't say I know on windows..
also, why not try exec or system and just run the normal system command for
it?
- Original Message -
From: Jeff [EMAIL PROTECTED]
To:
http://php.net/rename
-Original Message-
From: Randy Johnson [mailto:[EMAIL PROTECTED]]
Sent: 13 iulie 2001 20:53
To: Randy Johnson; Chris Lambert - WhiteCrown Networks;
[EMAIL PROTECTED]
Subject: [PHP] Rename a File?
How do I rename a file on Linux in PHP?
Thanks
Randy
mv filename newfilename
- Original Message -
From: Randy Johnson [EMAIL PROTECTED]
To: Randy Johnson [EMAIL PROTECTED]; Chris Lambert - WhiteCrown
Networks [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, July 13, 2001 12:53 PM
Subject: [PHP] Rename a File?
How do I rename a file on
I think you can rename it by using a full path. Have you tried it yet?
Cheers,
Maxim Maletsky
-Original Message-
From: Miguel Loureiro [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 12:02 AM
To: php-gen
Subject: [PHP] rename?
Hi ,
having a hierarchy of directories,
44 matches
Mail list logo