Skip to content
Advertisement

After changing name of a file it goes parent directory

I’m writing a PHP code that takes names from input.txt file and with those names it changes the names of files in the image folder.

My code is:

JavaScript

It works but at last, files in the ‘image’ folder go C:wamp64wwwReplace image names with input directory. (Parent directory)

Any idea why this happens?

Advertisement

Answer

To make it more clear. Here is what your code is doing:

JavaScript

effectively you’ve written a move and rename function. For simplicity you can just do:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement