cedric_charles Posted November 16, 2012 Share Posted November 16, 2012 Hi everybody ! I have a big problem with my images on my FTP... A friend has uploaded thousands of images with a "+" character in the filename on our FTP. For some reasons, my CMS doesn't support it and I need to change the "+" character by a "_" character, directly on the FTP cause it will rake too much time to download all the images and upload them again. So I need a script (PHP ?) that will go in the right subdirectory and replace the "+" if it exists by the "_" character. Someone could help me ? Thanks, Cedric Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/ Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 Have you first attempted to solve this yourself? Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392958 Share on other sites More sharing options...
cedric_charles Posted November 16, 2012 Author Share Posted November 16, 2012 Yes I have, but I'm unfortunately not a PHP Guru.... Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392960 Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 Yes I have, but I'm unfortunately not a PHP Guru.... Show us what you've done so far. Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392961 Share on other sites More sharing options...
cedric_charles Posted November 16, 2012 Author Share Posted November 16, 2012 I have nothing to show you since I've just done some research but don't know how to do it... It's why I'm here, because I don't know how do do it... Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392964 Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 Well nobody here is just going to write it for you. At least show that you've made an effort and the help you get will be astounding. Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392966 Share on other sites More sharing options...
MDCode Posted November 16, 2012 Share Posted November 16, 2012 Look into .htaccess url rewrite Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392968 Share on other sites More sharing options...
cedric_charles Posted November 16, 2012 Author Share Posted November 16, 2012 If I'm not good enough to write it myself, I can just go out ? I tought it was a mutual assistance forum... If I could write it myself, I would not be here... Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392972 Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 It's not the sort of place where people can pop in and have code written for them as they please. This place is to help people become better at programming. Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392974 Share on other sites More sharing options...
Muddy_Funster Posted November 16, 2012 Share Posted November 16, 2012 If I'm not good enough to write it myself, I can just go out ? I tought it was a mutual assistance forum... If I could write it myself, I would not be here... It is, we will happily assist you with your code, which you don't have any of, hence the glaring lack of assistance. If you want someone to write the code for you there is a freelance section where you can request someones services for a suitable fee. Getting flippent isn't going to endear anyone to your cause any faster. The statement isn't "If I'm not good enough to write it myself, I can just go out" it's more along the lines of "If your not going to bother your arse to even try, when it is you that will get the benefit, then why the hell should we when we will get none?" Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392976 Share on other sites More sharing options...
Pikachu2000 Posted November 16, 2012 Share Posted November 16, 2012 Here are some php manual entries for functions you might find useful for this. At least have a look and see what you can come up with. If you have any questions about the functions, please do ask. glob foreach str_replace rename Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392977 Share on other sites More sharing options...
cedric_charles Posted November 16, 2012 Author Share Posted November 16, 2012 Thanks you Pikachu2000 I know about foreach() and str_replace(), but what bothers me is the FTP side :s Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392983 Share on other sites More sharing options...
Pikachu2000 Posted November 16, 2012 Share Posted November 16, 2012 You mean the fact that files can be ftp'd with those characters to begin with? Short of writing a shell script to change the file names, there isn't much I can think of. Since the characters are technically valid for use in file names, I'd be more likely to alter the CMS code to eliminate the problem. Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392986 Share on other sites More sharing options...
cedric_charles Posted November 16, 2012 Author Share Posted November 16, 2012 Thanks you Pikachu. I couldn't alter the CMS code cause it's Wordpress and if I do this, it will be impossible to update it without lossing my changes... Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1392992 Share on other sites More sharing options...
Pikachu2000 Posted November 16, 2012 Share Posted November 16, 2012 Is this a one-shot deal, or is it something that's likely to be an ongoing issue? Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1393005 Share on other sites More sharing options...
cedric_charles Posted November 16, 2012 Author Share Posted November 16, 2012 I don't really understand what you mean :s Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1393006 Share on other sites More sharing options...
Beeeeney Posted November 16, 2012 Share Posted November 16, 2012 I don't really understand what you mean :s Is this problem that you're having now going to be a problem again at some point in the future? Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1393007 Share on other sites More sharing options...
Pikachu2000 Posted November 16, 2012 Share Posted November 16, 2012 I mean is FTP the normal method of uploading files, or was it just this one time because of the sheer volume, and normally it would be handled by a php form? Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1393008 Share on other sites More sharing options...
cedric_charles Posted November 19, 2012 Author Share Posted November 19, 2012 Hi, I hope you have had a nice weekend ! It is handle by the php form, but it seems to be a well known Wordpress issue... Quote Link to comment https://forums.phpfreaks.com/topic/270788-replace-character-in-filename-directly-in-ftp/#findComment-1393504 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.