LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 05:23 PM   #1
Drigo
Member
 
Registered: May 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, 05: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, 10:35 PM   #3
Drigo
Member
 
Registered: May 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-01-2009, 11:14 PM   #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, 07: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



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

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

All times are GMT -5. The time now is 05:25 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
Open Source Consulting | Domain Registration