tedteeter;11031267 wrote:Curiously, even after re-vamping my code from making a backup copy of a txt file after a complete read to a back up copy prior to even opening the file php still removes line breaks, carriage returns when a new file is created with "Copy", "Rename" Oddly, "Rename" shouldn't but yet the backup copy has all returns, breaks removed?
Speaking of your code... where is it? It's hard for us to speculate when we have no idea what your code is doing to the data. 😉
tedteeter;11031279 wrote:Briefly, while not the solution, I did learn that it is important to retain the same file extension.
Nonsense; file extensions do nothing to retain (or alter) the contents of the file. They're really nothing more than a convenience to your O/S so that it knows how it should treat the content of the file.
tedteeter;11031279 wrote:As I attempted to copy and rename to an extension of "bkup" i.e "contactbook.bkup" the carriage returns, line breaks disappeared. I changed the extension back to "txt" i.e "contactbookbackup.txt" and the returns, breaks were preserved. However, this defeats the different file name I desired for directory scans etc...any ideas?
One idea is that you should convince yourself that no modern day file system (at least, none that I know of) is going to change the contents of a file just because you rename the extension (and, even more bizarrely, somehow restore the missing data if you rename it back to the old extension).
Next, you should probably explain both 1) how you're copying/renaming the files, and 2) how you're viewing the files after you've renamed them. Number (2) is important because if, for example, you're using a web browser to view the files, it's likely that your browser is interpreting the file's contents of HTML (in which line breaks are ignored).