LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-09-2012, 05:04 PM   #1
mad_penguin
Member
 
Registered: Mar 2008
Posts: 69

Rep: Reputation: 15
how to copy time stamps


Hi Gents,

Does any of you know how could I copy time stamps from one directory to another ? I mean, I have 2 dirs and I want to copy the exact time stamps from first dir to the second one.

I know about 'touch' although I wouldn't want to 'stamp' each file and directory.

Any ideas?


Cheers!
 
Old 08-09-2012, 05:36 PM   #2
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 223

Rep: Reputation: 62
Quote:
Originally Posted by mad_penguin View Post
Hi Gents,

Does any of you know how could I copy time stamps from one directory to another ? I mean, I have 2 dirs and I want to copy the exact time stamps from first dir to the second one.

I know about 'touch' although I wouldn't want to 'stamp' each file and directory.

Any ideas?


Cheers!

is using the '-a' switch to `cp` what you're looking for? for example:

Code:
ls -la /etc/udev/
total 16
drwxr-xr-x  3 root root 4096 May 16 04:30 .
drwxr-xr-x 69 root root 4096 Aug  9 23:13 ..
drwxr-xr-x  2 root root 4096 May 16 04:30 rules.d
-rw-r--r--  1 root root  277 May 23 12:50 udev.conf
Code:
mkdir /tmp/test-udev && cp -Ra /etc/udev/* /tmp/test-udev/
Code:
ls -la /tmp/test-udev/
total 16
drwxr-xr-x 3 root root 4096 Aug  9 23:34 .
drwxrwxrwt 6 root root 4096 Aug  9 23:34 ..
drwxr-xr-x 2 root root 4096 May 16 04:30 rules.d
-rw-r--r-- 1 root root  277 May 23 12:50 udev.conf
another way of doing this can be done by using `rsync`. for example:

Code:
rsync -Waq /etc/udev/ /tmp/test-udev2/
hope that helps
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] average of unix time stamps xeon123 Linux - Newbie 2 03-25-2011 09:49 AM
[SOLVED] add time stamps to files VickIsSlick Linux - Newbie 5 12-16-2010 08:53 PM
Time Stamps for command history? WingnutOne Linux - Newbie 3 09-11-2007 09:53 AM
Time stamps following move to British Summer Time aikempshall Linux - General 2 03-30-2007 09:30 AM
Time Stamps Duplication indiancosmonaut Solaris / OpenSolaris 4 02-28-2007 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration