|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: NEW ZEALAND
Posts: 1,657
|
changing the date of a file on a webserver
I got 10000's html files hosted that where from 2004 to 2006 etc
is there a script or programe i can use to change the 10000's html files date from 2005/2006 to 2008 thanks i found a lot of file date changers on google but they only work with windows |
|
|
|
|
|
#2 |
|
Mostly retired
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
|
If you're using *NIX (UNIX/Linux) like I assume, couldn't you write a simple PHP script that just rips through all the files in the directory, opens them and then saves them all, changing the modified time to the day the script was run on?
__________________
|
|
|
|
|
|
#3 | |
|
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: NEW ZEALAND
Posts: 1,657
|
Quote:
but i dont know how to write a php script like that |
|
|
|
|
|
|
#4 | |
|
Mostly retired
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
|
Quote:
PHP Code:
__________________
|
|
|
|
|
|
|
#5 |
|
Confirmed User
Industry Role:
Join Date: Jan 2003
Location: In a Tater Patch
Posts: 2,321
|
you can use the system command touch to change the timestamp on a file as well. no need to use all the resources to open/close a file.
__________________
Managed Hosting - Colocation - Network Services Yellow Fiber Networks icq: 19876563 |
|
|
|
|
|
#6 |
|
Chafed.
Join Date: May 2002
Location: Face Down in Pussy
Posts: 18,041
|
Yeah, touch is way more efficient and is designed to do exactly what you want.
|
|
|
|
|
|
#7 | |
|
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: NEW ZEALAND
Posts: 1,657
|
Quote:
will it change the date on all files? as i just want .html to change |
|
|
|
|
|
|
#8 |
|
Confirmed User
Join Date: Apr 2002
Location: /root/
Posts: 4,997
|
go to the directory where the files are and run this command (ssh)
Code:
find . -name "*.html" -print0|xargs -0 touch P.S. the php script above changes all files regardless of extension |
|
|
|
|
|
#9 | |
|
Mostly retired
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
|
Quote:
As for me, one day I'll lock myself in a room and force myself to learn the ins and outs of Linux... one day...
__________________
|
|
|
|
|
|
|
#10 |
|
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: NEW ZEALAND
Posts: 1,657
|
thanks guys for the help
i used find . -name "*.html" -print0|xargs -0 touch and it worked great |
|
|
|
|
|
#11 | |
|
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: NEW ZEALAND
Posts: 1,657
|
Quote:
it took me years to learn windows |
|
|
|
|