Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to change the file time of a m#merge the files to a temporary file.

mergecap -w  "${dir_dcn}"/merge_dcn.pcap "${FILES_dcn[@]}"

touch -r "${FILES_dcn[14]}" dcn_file

ls -l dcn_file >> /mnt/md0/capture/file1.txt
ls -l "${FILES_dcn[14]}" >> /mnt/md0/capture/file2.txt

#delete originals
rm  ${FILES_dcn[@]}
#rename to proper name
mv  "${dir_dcn}"/merge_dcn.pcap  "${dir_dcn}"/"${TAG1_dcn}".pcap

touch -r dcn_file "${dir_dcn}"/"${TAG1_dcn}".pcap
ls -l "${dir_dcn}"/"${TAG1_dcn}".pcap >> /mnt/md0/capture/file3.txt

But the log files suggest that after the last touch command the file time is current time rather than the time from dcn_file. I'm using Ubuntu 12 with samba share to access the files.

File 1

-rw-r--r-- 1 root root 0 Mar 10 14:30 dcn_file

File 2

-rw-rw-rw- 1 nethawk nethawk 2098040 Mar 10 14:13 /mnt/md0/capture/dcn/dcn_2014_03_10_14_13_58_930.pcap

File 3

-rw-r--r-- 1 root root 60510376 Mar 12 10:15 /mnt/md0/capture/dcn/dcn_2014_03_10_14_30_29_985.pcap
share|improve this question
Try running the script on local files, to see if it's a Samba bug. – Gilles Mar 12 '14 at 23:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.