![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Retain Only specific number of file in Directory | ranvijaidba | UNIX for Advanced & Expert Users | 2 | 01-05-2009 06:47 AM |
| Retain file permissions when saving .sh file from internet [OS X] | baza210 | Shell Programming and Scripting | 4 | 12-11-2008 10:18 AM |
| How to retain the header information of a file | ahjiefreak | UNIX for Dummies Questions & Answers | 0 | 12-04-2007 07:21 PM |
| How to retain file permissions during FTP on Solaris 5.9 ? | gauravsachan | UNIX for Advanced & Expert Users | 3 | 04-26-2007 11:19 AM |
| parse an arpwatch file and retain most recent mac | CM64 | Shell Programming and Scripting | 8 | 04-12-2007 01:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Retain File Timestamp
There are directories of files that I have to run the dos2ux command on to get ride of the carriage return characters. Easy enough, but I have to retain the original timestamps on the files. I am thinking that I am going to have to strip off the timestamp for each file and convert it to unix time and then run touch against each file after recreating the file with dos2ux. This is probably as clear as mud, but does anyone have any elegant ideas for accomplishing this?
I am planning to loop through the listing but my elegance lags when I try am trying to figure out the best way to do the conversion. Or am I missing some tool available on HP-UX that will not alter the timestamp but will remove the ^M from the end of every line? Thanks in advance. |
|
||||
|
If your unix has "touch -r <reference file> filename" is is fairly easy to "cp -p" the original file to preserve the file modification timestamp then edit the original file and restore the file modification timestamp with "touch -r". This method will not retain the file creation timestamp.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|