LinuxQuestions.org
Register a domain and help support LQ
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 07-01-2009, 06:23 PM   #1
Drigo
Member
 
Registered: Jun 2009
Posts: 111

Rep: Reputation: 17
How to change modification time/time created recursively??


Hello,
I know there exists a touch command to change the date of the files. However, I want to change the files of a directory and the directory time. Is there a command that can help me with this?? like -R Can you please provide me an example of the command?

Thank you,
Drigo
 
Old 07-01-2009, 06:26 PM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
Something like:

Code:
find /path/to/files -exec touch -t 200906122350 {} \;
 
Old 07-01-2009, 11:35 PM   #3
Drigo
Member
 
Registered: Jun 2009
Posts: 111

Original Poster
Rep: Reputation: 17
Thank you! It worked. I wantt o have the current time so I ommitted the -t command. What does {} \; mean? I guess the find will find the files in the path..... and with exec, we execute the command touch....
 
Old 07-02-2009, 12:14 AM   #4
alpha01
Member
 
Registered: Jul 2008
Location: Orange County
Distribution: Ubuntu/Debian, CentOS, RHEL, FreeBSD, OS X
Posts: 75

Rep: Reputation: 19
Quote:
Originally Posted by Drigo View Post
Thank you! It worked. I wantt o have the current time so I ommitted the -t command. What does {} \; mean? I guess the find will find the files in the path..... and with exec, we execute the command touch....
If you include the -exec parameter to the find command. {} \; tells to execute the following command on what ever it finds.
 
Old 08-05-2009, 08:45 AM   #5
afkhan
LQ Newbie
 
Registered: Aug 2009
Posts: 1

Rep: Reputation: 0
Need help with touch command

Hi,

I am trying to do a touch on some file in the a heirarchy but the timestamp for the directory where the file exist doesnot change. Even this is not getting propogated to the parents till the root.

this is what i am using currently


#!/bin/sh
for i in "ls"
do find . -name "m2.cmb" -exec touch {} \;
done

Any help is greatly appreciated.....


Regards
 
  


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
file modification time graziano1968 Linux - Server 1 08-25-2008 10:06 AM
howto evaluate modification-time? minike Programming 3 05-06-2008 05:13 PM
unable to modify created and modification time of symbolic links avanigadhai Programming 4 03-03-2008 12:19 AM
time stamp for file modification youngstorm Linux - Newbie 2 11-01-2005 04:46 PM
modification time in the future adam_boz Linux - Software 2 07-28-2002 08:51 AM


All times are GMT -5. The time now is 01:00 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