2 Replies - 459 Views - Last Post: 18 July 2013 - 09:02 AM Rate Topic: -----

#1 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Trouble renaming/moving file

Posted 18 July 2013 - 08:33 AM

Here's the code:

                        //move the old file
			echo getcwd();
			$path = 'c:\\xampp\\htdocs\\folderName\\';
			$oldFile = '\\files\\'.$currFileName.".pdf";		
			$path1 = $oldFile;
			//echo $path1;
			
			$path2 = '\\files\\archives\\'.$newFileName;
			rename($path1, $path2);			


NB i have changed the sitename above to simply 'folderName' for privacy reasons, but in the code the actual sitename is correct


So i have been working on this for a while and i keep getting hit with an error along the lines of:

Quote

Warning: rename(\files\1-M-Edwards.pdf,\archives\1-M-Edwards-17:18:48-18-07-13.pdf): The system cannot find the path specified. (code: 3) in C:\xampp\htdocs\folderName\general.php on line 406


Either this error or one saying that the directory label syntax is incorrect.

I have tried almost every possibility known to man including both forward and backslashes (working on windows), using the realpath() function, using the getcwd() function, many combinations of using either ./ or ../ or.\ ..\

nothing seems to work.

Anyone here able to see what i am doing wrong? I sure as hell can't

Regards
A very frustrated programmer

Is This A Good Question/Topic? 0
  • +

Replies To: Trouble renaming/moving file

#2 lukasz_ltt  Icon User is offline

  • New D.I.C Head

Reputation: 18
  • View blog
  • Posts: 29
  • Joined: 12-October 12

Re: Trouble renaming/moving file

Posted 18 July 2013 - 08:58 AM

Try to not use ':' in file names. On Windows I cannot create file with colons.
Was This Post Helpful? 3
  • +
  • -

#3 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: Trouble renaming/moving file

Posted 18 July 2013 - 09:02 AM

Wow, completely overlooked that. Works now, cheers
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1