Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help in changing file names 1

Status
Not open for further replies.

elentz

Technical User
Jan 9, 2007
81
0
0
US
I have several hundred files that are named in a way that will not work for the way I want to use them. We saved these files with filenames and now we want to change the names. For example the files were named with a 4 digit number. It was an account number for the customer that the file was associated with. Now we use the phone number when we save the file. So now I have several hundred files in the wrong naming convention. I have a list of the customer phone numbers and the account codes. What I am looking for is some way to rename the files using the list to remove the account number and replace it with the phone number. Can someone suggest a method of accomplishing this?
Thanks
 
If your doing it with PHP can you get a command prompt and run the script from there ?
 
Hmm. it still sounds like a bad file name or you don't have permissions to write to the directory. Did the error handling code I suggested reveal any obvious errors?

Code:
strFileName = replace(objFile.Name, strAccount, strPhoneNumber)
msgbox strFileName
[\code]

-Geates
 
Can't get a command prompt, my server is on a shared Linux system at my website. Using FTP I changed all the file properties to 0666, I kept getting an error saying that I couldn't execute files with permissions above 0755 from my provider. The error handling code produced no errors. Maybe this weekend I will setup WAMP server on my laptop and try it from there. I haven't given up on the VBS solution, but all I get there is an error also. And that I am running on my laptop with the files and the account/phone list on it as well. I wanted something that would keep me from having to do this manually, but I think I have spent almost as much time on this. :) Isn't that the way. Don't take me wrong guys I really appreciate your help!!
 
you should get some output with my script. whether they are failures or successes, the code will still spew something out. what did you get on the browser?
 
All I get is "500 - Internal Server Error"

Common reasons for this error are:

* Incorrect file/directory permissions: Above 755.

In order files to be processed by the webserver, their permissions have to be equal or below 755. You can update file permissions with a FTP client or through cPanel's File Manager.
* Incorrect Apache directives inside .htaccess file.

Make sure you have not specified unsupported directives inside the local .htaccess file. Such include PHP settings and Apache module settings.
 
oh. then perhaps reset things through cpanel? change down the perms to 755.
 
Well, going into CP and changing all the files to 0755 and the script to 755 got rid of the error but it didn't cnage the names nor did it throw an error. I just got a blank screen. I have all the files and the account/phone list, and the script in the same directory under my web root. I am using the full path to the directory and the files.
 
you cannot get a blank screen with my code. you will _always_ get some response if you are using the script i posted just above.
 
I apologize jpadie!

I did not use the code you provided just above until just now. It worked! It even kept the original files, that is a bonus!

Thank you !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top