LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-02-2014, 04:57 AM   #1
Torquemalex
LQ Newbie
 
Registered: Aug 2008
Posts: 6

Rep: Reputation: 0
Script to change date/time


Hi everybody!
I need to perform a task with a script but I have no idea how to do it, I hope someone could help me:
- on my linux pc I have many folders with movies, tv shows, toons, ecc.
They are shared by a dlna server to my panasonic tv where I can browse and see them.
The problem is that they are sorted with date/time only and there's no way on the TV or on the dlna server to change the sort method to alphabetical.
What I need is a script that changes date/time (no matter to when, but every file should be 1 min or 1 hour or one day more than the previous) according to the alphabetical order, within each subdirectory of a master path.
Can you please help me?

Thanks in advance and best regards!

Alex
 
Old 09-02-2014, 06:25 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
The "date" command accepts a user specified date/time, and converts it as you wish. See the manpage. Here is an example
Code:
date -d "01 jan 2010 00:02" +%F_%T
Use some variables, and increment in a loop - use that to rename your files.
 
Old 09-02-2014, 06:31 AM   #3
Torquemalex
LQ Newbie
 
Registered: Aug 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
The "date" command accepts a user specified date/time, and converts it as you wish. See the manpage. Here is an example
Code:
date -d "01 jan 2010 00:02" +%F_%T
Use some variables, and increment in a loop - use that to rename your files.
I don't want to rename the files, I need to change their date/time.
 
Old 09-02-2014, 06:38 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
"man touch"
 
  


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
Each time a script is called. A log file is created with time and date + Bash Script. y0_gesh Programming 6 08-17-2012 04:16 AM
Log Date/time doesn't change with system time saurabhchokshi Linux - Software 5 07-07-2010 01:27 AM
Change system time or date or both lel800 Linux - Newbie 6 10-28-2003 08:00 PM
how to change date and time in slackware 8.1 erikm103 Linux - Newbie 4 02-25-2003 07:26 PM
how do you change the date / time? jkane Linux - General 2 01-15-2002 10:09 PM


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