| 1. |
Solve : How to use TYPE command? |
|
Answer» I have a problem where php files have the wrong linefeed after uploading them via ftp. I'm looking for a way to do a batch convert on a nmber of files to fix this problem. I found this article http://en.wikipedia.org/wiki/Newline#Conversion_utilities that says that can be done by typing in Code: [Select]TYPE unix_file | FIND "" /V > dos_file I have a problem where php files have the wrong linefeed after uploading them via ftp. I'm looking for a way to do a batch convert on a nmber of files to fix this problem. I found this article http://en.wikipedia.org/wiki/Newline#Conversion_utilities that says that can be done by typing in Code: [Select]TYPE unix_file | FIND "" /V > dos_file that's code is working fine here. i tested out this .php file i obtain from net. when viewed in notepad, the line break show as SOMETHING like rectangle character. (ascii 10). after running the command type|find, the line break is properly fixed as ascii13+ascii10 character 13 is carriage return, character 10 is line feed. DOS uses crlf, Unix uses lf, and mac uses cr. An alternative method could be to upload the files using binary mode rather then text.Quote from: Reno on March 23, 2009, 11:16:07 PM that's code is working fine here. i tested out this .php file i obtain from net. when viewed in notepad, the line break show as something like rectangle character. (ascii 10). after running the command type|find, the line break is properly fixed as ascii13+ascii10I tried debug filename.php -d, using the full path for the filename. Right after pressing enter, it days file can't be found and then hangs. A ctrl z won't end it. Quote from: BC_Programmer on March 23, 2009, 11:34:34 PM character 13 is carriage return, character 10 is line feed.I've been fighting this problem for over a year. Others have suggested forcing the upload in ascii as well as binary. I've tried both ways but it dosn't make a difference. The problem is that sometimes I may have forty files with this problem mixed in with other files that are fine and of different types. So forcing an upload, even if that worked, would require more work than fixing each file manually and then uploading normally. I tried using sed to do it but can't get that to work either (nor could the sed groups I asked in). Then I ran across this command and thought my problems were solved. But I'm beginning to think this is a problem without a solution.This is one solution:http://download.cnet.com/Unix2DOS/3000-2381_4-10488164.html Thanks for the link. I wasn't AWARE of that program. It won't help since it only handles one file at a time but I did find one with the same name that says it runs in batch mode but it doesn't work as described. But that gives me something to search for. If two of these exists, there are PROBABLY others so I will keep looking. Thanks for all of the help. It did make a difference and I appreciate it. Sometimes solutions can be found outside of the box I just wanted to post the solution I found since it may help others. There is a free shell program named Flip - http://ccrma-www.stanford.edu/~craig/utility/flip/I added it as a button to my file manager app so I just NEED to select the files in question, click that button and it converts and uploads the files. I wouldn't have found it without the suggestions here so I truly appreaciate that. This has ended a very long battle. |
|