Is there an option in textto not to change the file time when running
with -l and -c options?
ahsan <akhan@banderacom.com> wrote:
Is there an option in textto not to change the file time when running
with -l and -c options?
No, but you could use the ‘touch’ utility to restore it.
-seanb
I don’t think there is.
You can write a convoluted script that:
- copies a file to a new temp.name
cat old.file | textto > temp.name - touches the new file with the old date/time stamp
touch -tfind . -name old.file -printf "%TY%Tm%Td%TH%TM"
temp.name - and replaces the original file
rm old.file
mv temp.name old.file
“ahsan” <akhan@banderacom.com> wrote in message
news:ahjt07$i20$1@inn.qnx.com…
Is there an option in textto not to change the file time when running
with -l and -c options?
\
“Bill Caroselli (Q-TPS)” wrote:
I don’t think there is.
You can write a convoluted script that:
- copies a file to a new temp.name
cat old.file | textto > temp.name- touches the new file with the old date/time stamp
touch -tfind . -name old.file -printf "%TY%Tm%Td%TH%TM"
temp.name- and replaces the original file
rm old.file
mv temp.name old.file
Wouldn’t it be simpler to…
cp oldfile newfile
textto newfile
touch -r oldfile newfile
mv newfile oldfile
Actually, since the QNX version of cp preserves the original file time,
you could also do:
cp oldfile tempfile
textto oldfile
touch -r tempfile oldfile
rm tempfile
lew
I did not know about the -r option to touch.
Thank you.
“Lewis Donzis” <lew@nospam.donzis.com> wrote in message
news:3D3E2645.3080C75F@nospam.donzis.com…
“Bill Caroselli (Q-TPS)” wrote:
I don’t think there is.
You can write a convoluted script that:
- copies a file to a new temp.name
cat old.file | textto > temp.name- touches the new file with the old date/time stamp
touch -tfind . -name old.file -printf "%TY%Tm%Td%TH%TM"
temp.name- and replaces the original file
rm old.file
mv temp.name old.fileWouldn’t it be simpler to…
cp oldfile newfile
textto newfile
touch -r oldfile newfile
mv newfile oldfileActually, since the QNX version of cp preserves the original file time,
you could also do:cp oldfile tempfile
textto oldfile
touch -r tempfile oldfile
rm tempfilelew
“Bill Caroselli (Q-TPS)” wrote:
I did not know about the -r option to touch.
That’s the ticket. Come to think of it, no reason to actually copy the
data…
touch -r oldfile tempfile
textto oldfile
touch -r tempfile oldfile
rm tempfile
Never enough optimization!
lew
“Lewis Donzis” <lew@nospam.donzis.com> wrote in message
news:3D3F6A0C.67CC1248@nospam.donzis.com…
Never enough optimization!
Every program has at least one bug.
Every program can be reduced by at least one line.
Therefore, every program can be reduced to one line that doesn’t work.
-James Ingraham