Re: Re: renamed images are now corrupt...
| From: | Adam Bregenzer | Date: | Fri, 27 Feb 2004 02:19:22 +0000 |
| Subject: | Re: Re: renamed images are now corrupt... | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178982@lists.php.net to get a copy of this message | ||
On Thu, 2004-02-26 at 20:18, Bryan Henry wrote:
> I realized that I did not trim the end line characters off of the file
> extensions
> after I grabbed all the file names from a text file. Now all the images
> have
> end of line chracters as part of the extension. I cannot access/edit the
> files
> through SHH, PHP or FTP...
You should be able to through a shell. Try using a shell script to
rename the files, here's something in bash script to get you started:
for x in
ls; do
good_name=echo -n ${x}|sed "s/\(.*\.[a-zA-Z]*\)/\1/";
mv ${x} ${good_name};
done
This will find any characters followed by a '.' and any upper or
lowercase letter. This should grab everything except for the newline at
the end and rename the file accordingly. Since I don't have any files
with newlines in their names I didn't test it so it may need a bit of
tweaking.
Regards,
Adam
--
Adam Bregenzer
adam@bregenzer.net
http://adam.bregenzer.net/