Page 1 of 1

Script to change date to current?

Posted: December 7th, 2011, 6:13 pm
by boognish43
Im hoping to find a solution to my problem. I have sabnzbd download files to a directory and I would like it so if I sorted by date it would list in order of when it was downloaded.

I use xbmc to view video files I d/l but if it is an older show it puts it last on the list. Id like to have the newest downloads at the top which is sorted by file date.

Does anyone know how I should solve this?

thanks!

Re: Script to change date to current?

Posted: December 9th, 2011, 1:31 am
by Mar2zz
xbmc has differnt types of sorting. You should sort on filename in ascending order.

Re: Script to change date to current?

Posted: January 8th, 2012, 1:45 pm
by boognish43
Ok after researching more on what my issue was. I need to change the date modified to the date created.

i.e. episode.mkv was downloaded on 1/8/2012 but uploaded to usenet on 1/4/2012. My file in windows shows that the file was modified on 1/4/2012 but created on 1/8/2012.

I would like to be able to change the date modified to whatever is in the date created field.

Xbmx will only allow me to sort by date modified

my dirty fix thought was to have a script rename the file(maybe just adding a 1 to the end)

how can I go about this?

Re: Script to change date to current?

Posted: January 8th, 2012, 1:56 pm
by Mar2zz
use touch -params "$1"

touch --help tells you more about params. touch -m changes the modified field only, it changes it to time it's touched (time of postprocessing), but you can specify times if you want to.

(well, I hope you run linux or xmbc-live, or else touch is not a function you can use)

Re: Script to change date to current?

Posted: January 8th, 2012, 2:03 pm
by boognish43
Thanks for replying so fast!

I can use this script with windows correct?

Another dumb question(im learning)

I am currently using this script to delete extras - can I just add this line touch -m "$1" to the script?

Code: Select all

@echo off
setlocal

echo.
echo [Cleanup] Cleaning up download directory: %1

echo [Cleanup] Deleting .nzb files
DEL  %1\*.nzb  /S /F /Q 

echo [Cleanup] Deleting .sfv files
DEL  %1\*.sfv  /S /F /Q 

echo [Cleanup] Deleting .nfo files
DEL  %1\*.nfo  /S /F /Q 

echo [Cleanup] Deleting .sub files
DEL  %1\*.sub  /S /F /Q 

echo [Cleanup] Deleting .idx files
DEL  %1\*.idx  /S /F /Q 

echo [Cleanup] Deleting .sample files
DEL  %1\*sample*.avi  /S /F /Q 

echo [Cleanup] Deleting .sample files
DEL  %1\*sample*.mkv  /S /F /Q 

echo [Cleanup] Deleting .sample files
DEL  %1\*sample*.mp4  /S /F /Q 

echo [Cleanup] Deleting .srr files
DEL  %1\*.srr /S /F /Q 

echo [Cleanup] Deleting .srs files
DEL  %1\*.srs /S /F /Q 

echo.

Re: Script to change date to current?

Posted: January 8th, 2012, 2:06 pm
by Mar2zz
I don't know windows commands sorry. Maybe someone else does.
Here is something, but touch doesn't seem to be a native command on windows.
http://superuser.com/questions/10426/wi ... mand-touch

Re: Script to change date to current?

Posted: January 8th, 2012, 2:19 pm
by boognish43
thanks but thats way over my head :)

Lets hope a windows guru can shed some light

thanks again for the help Mar2zz!