[SOLVED] file rename to date and time created
Moderator: DosItHelp
-
- Posts: 5
- Joined: 22 Dec 2015 00:33
[SOLVED] file rename to date and time created
Hi All.
After quite a bit of searching various sites I am still at a loss regarding this problem.
I have a security camera which records its feed as 30 minute segments using a filename format of
***.***.*.***-00-hhmmss (***.***.*.*** = ip address of camera)
I would like to batch rename the files using the file creation date as follows
dd.mm.yyyy-hhmm
All of the solutions I have come across on the Internet are for either appending the date or time and start off simple but then escalate into code that would probably fill a book.
Any help with this would be really appreciated.
Thanks
Colin
After quite a bit of searching various sites I am still at a loss regarding this problem.
I have a security camera which records its feed as 30 minute segments using a filename format of
***.***.*.***-00-hhmmss (***.***.*.*** = ip address of camera)
I would like to batch rename the files using the file creation date as follows
dd.mm.yyyy-hhmm
All of the solutions I have come across on the Internet are for either appending the date or time and start off simple but then escalate into code that would probably fill a book.
Any help with this would be really appreciated.
Thanks
Colin
Last edited by buffyiscool on 23 Dec 2015 05:25, edited 1 time in total.
Re: file rename to date and time created
buffyiscool wrote:I have a security camera which records its feed as 30 minute segments using a filename format of
***.***.*.***-00-hhmmss (***.***.*.*** = ip address of camera)
I would like to batch rename the files using the file creation date as follows
dd.mm.yyyy-hhmm
Colin, What OS version are you using?
Do you have restrictions on the tools you want to use?
Run this in the folder and shows us some screen output - the format is important.
Code: Select all
@echo off
for %%a in (*.*) do echo %%~ta
pause
-
- Posts: 5
- Joined: 22 Dec 2015 00:33
Re: file rename to date and time created
Hi foxidrive
Thanks for the reply.
I am using Windows 7 OS. Ideally my request would be just code that I could add to an existing batch file which currently changes the extension from .264 to .mpeg.
I ran the code you provided in one of the folders and also took a screenshot of the folder so you could see the original filename format.
Hope you can see the image above.
Once again thanks.
Colin
Thanks for the reply.
I am using Windows 7 OS. Ideally my request would be just code that I could add to an existing batch file which currently changes the extension from .264 to .mpeg.
I ran the code you provided in one of the folders and also took a screenshot of the folder so you could see the original filename format.
Hope you can see the image above.
Once again thanks.
Colin
Re: file rename to date and time created
You can copy and paste from the CMD prompt. Please do so.
-
- Posts: 5
- Joined: 22 Dec 2015 00:33
Re: file rename to date and time created
This is the output from the previous code posted.
Code: Select all
22/12/2015 00:54
22/12/2015 01:24
22/12/2015 01:54
22/12/2015 02:24
22/12/2015 02:54
22/12/2015 03:24
22/12/2015 03:54
22/12/2015 04:24
22/12/2015 04:54
22/12/2015 05:24
22/12/2015 05:45
21/12/2015 21:54
21/12/2015 22:24
21/12/2015 22:54
21/12/2015 23:24
21/12/2015 23:54
22/12/2015 00:24
22/12/2015 11:37
Press any key to continue . . .
-
- Posts: 5
- Joined: 22 Dec 2015 00:33
Re: file rename to date and time created
Hi All
Just to say thanks for all the help I received on this topic.
I have managed to do what I wanted by creating a small vb.net program.
Thanks again. Merry Christmas and all the best for 2016.
Colin
Just to say thanks for all the help I received on this topic.
I have managed to do what I wanted by creating a small vb.net program.
Thanks again. Merry Christmas and all the best for 2016.
Colin
Re: file rename to date and time created
buffyiscool wrote:I have managed to do what I wanted by creating a small vb.net program.
Excellent. I was waylaid and forgot to return. Sorry.
Thanks again. Merry Christmas and all the best for 2016.
Colin
All the best to you, also. Cheers.
Re: file rename to date and time created
buffyiscool wrote:This is the output from the previous code posted.Code: Select all
22/12/2015 00:54
Press any key to continue . . .
This code should rename the files as you've requested. Test it in a folder of copies first.
Code: Select all
@echo off
for %%a in (*-*-*) do for /f "tokens=1-5 delims=/: " %%b in ("%%~ta") do ren "%%a" "%%b.%%c.%%d-%%e%%f"
Re: file rename to date and time created
Replacingfoxidrive wrote:Code: Select all
for %%a in (*-*-*) do for /f "delims=/: " %%b in ("%%~ta") do ren "%%a" "%%b.%%c.%%d-%%e%%f"
Code: Select all
"delims=/: "
Code: Select all
"tokens=1-5* delims=/: "
John A.
-
- Posts: 5
- Joined: 22 Dec 2015 00:33
Re: [SOLVED] file rename to date and time created
For those interested here is a screenshot of the vb.net program I created to perform the required task.
If image does not show you can view it here: https://www.dropbox.com/s/6tgnvsx4ez2jr ... e.jpg?dl=0
Once again thanks for all the help.
Colin
If image does not show you can view it here: https://www.dropbox.com/s/6tgnvsx4ez2jr ... e.jpg?dl=0
Once again thanks for all the help.
Colin
Re: file rename to date and time created
thefeduke wrote:should help.Code: Select all
"tokens=1-5* delims=/: "
John A.
Thank you John, it certainly requires the tokens. Colin's task doesn't have extensions so I didn't add code for it - why would you when it's not in the job description.