Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

script to update file timestamp

Original Message
Name: vish
Date: July 19, 2006 at 07:41:31 Pacific
Subject: script to update file timestamp
OS: sun os
CPU/Ram: sun4u
Model/Manufacturer: ultra-60
Comment:
hi,

I am trying to write a unix script that recursively goes into each directory and 'touches' the file to update the time stamp.....any help on how to go about it is appreciated..


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: July 19, 2006 at 10:02:02 Pacific
Subject: script to update file timestamp
Reply: (edit)

I'm not near a unix box, so this is:

# untested
find /mydir -type f -print|while read myfile
do
touch myfile
done


Report Offensive Follow Up For Removal

Response Number 2
Name: nails
Date: July 19, 2006 at 15:59:16 Pacific
Subject: script to update file timestamp
Reply: (edit)
Sorry, but I corrected a syntax error:

I'm not near a unix box, so this is:
# untested
find /mydir -type f -print|while read myfile
do
touch $myfile
done


Report Offensive Follow Up For Removal

Response Number 3
Name: ghostdog
Date: July 19, 2006 at 22:14:40 Pacific
Subject: script to update file timestamp
Reply: (edit)
find /mydir -type f |xargs touch

Report Offensive Follow Up For Removal

Response Number 4
Name: vish
Date: July 24, 2006 at 08:57:19 Pacific
Subject: script to update file timestamp
Reply: (edit)
I am new to unix, I saved the file as test.sh and changed permissions using chmod 777 test.sh. When i try to run using ./test or test I keep getting the message "command not found"...wht am i doing wrong here?

Report Offensive Follow Up For Removal

Response Number 5
Name: nails
Date: July 24, 2006 at 11:46:56 Pacific
Subject: script to update file timestamp
Reply: (edit)
I'm guessing that the directory where script test.sh resides isn't in your PATH. If your current directory is the directory where test.sh resides and it still doesn't work, try this:

./test.sh

If you want unix to search your current directory, append a period to end of PATH:

PATH=$PATH:.
export PATH

I must warn you about the security considerations of doing this - especially if you are the root user.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: script to update file timestamp

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




Batch File- Current Date in Excel

how to setup call of duty to joytok

WindowsME / HotMail Problem

Corrupt memory

Convert fat32 to Ntfs


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC