?
Solved

Rename all files in the folder to the created date

Posted on 2007-07-21
9
Medium Priority
?
215 Views
Last Modified: 2010-03-05
Hi,

I have taken some snaps in a digital camera.I need to rename all the photos to the created dates and time.
All the files in the same time
Regards
Sharath
0
Comment
Question by:bsharath
  • 5
  • 2
  • 2
9 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 19539966
There are a number of solutions already posted.  If you are happy with a dos batch command script then can you confirm which OS you are using?

Chris
0
 
LVL 11

Author Comment

by:bsharath
ID: 19539982
Windows 2003 OS
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 19540005
Apologies unless someone else advises sooner it'll take me a while as I haven't found one that works for me yet ... I am using XP however.

Chris
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 19540019
There is one here for win 2k that might work but I strongly recommend you work on a copy of some photos in a test folder as I cannot say if it'll work on 2003 ... unless someone else advises an alternative.

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 19540075
0
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 19540132
:: ================
:: READ THIS FIRST
:: ================
:: * Following inputs are required to run the script successfully
::    - Set 'FilesPath' variables value to location where the files reside (Like: C:\MyPictures)
::    - Set 'FileExt' variables value to files extension (like: jpg, avi, mpg)
:: * Successful will generate 'RenameHistory.txt' file on C: drive root
:: * Copy and paste following script in notepad and save it with any name having .cmd extension.

:: Batch Script Start
@Echo Off
SetLocal EnableDelayedExpansion

SET FilesPath=C:\MyPictures
SET FileExt=jpg

IF NOT EXIST "%FilesPath%" Goto ShowErr
IF EXIST C:\RenameHistory.txt DEL /F /Q C:\RenameHistory.txt

FOR /R "%FilesPath%" %%F IN (*.%FileExt%) Do (
      SET FDate=%%~tF
      SET MM=!FDate:~,2!
      SET DD=!FDate:~3,2!
      SET YYYY=!FDate:~6,4!
      SET Hrs=!FDate:~11,2!
      SET Min=!FDate:~14,2!
      SET AMPM=!FDate:~17,2!
      SET FDate=!MM!_!DD!_!YYYY!_!Hrs!_!Min!_!AMPM!.!FileExt!
      Echo Renaming: %%F
      Echo Renaming: %%F *WITH* !FDate! >>C:\RenameHistory.txt
      REN %%F !FDate!
)
Goto EndScript
:ShowErr
Echo '%FilesPath%' path/file does not exist!
:EndScript
ENDLOCAL
:: Batch Script End
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 19540173
FARHANKAZI

Nice to see someone who knows something ..  I thought I would be able to help but quickly found myself out of my depth, so I am pleased to leave it to you with no guilt that I am letting the requestor down.

BSHARATH

Sorry to have been of little help.

Regards
Chris
0
 
LVL 11

Author Comment

by:bsharath
ID: 19541694
farhankazi
I tried this script.

I created a folder and put in 3 different files with different ext.When i run the script nothing changes.I have given the same folder name as you mentioned
0
 
LVL 26

Accepted Solution

by:
Farhan Kazi earned 2000 total points
ID: 19542780
My previous script will perfectly for single file extension that you set in 'FileExt' variable.
Anyhow try following it will work for all file extensions.

:: ================
:: READ THIS FIRST
:: ================
:: * Following inputs are required to run the script successfully
::    - Set 'FilesPath' variables value to location where the files reside (Like: C:\MyPictures)
:: * Successful will generate 'RenameHistory.txt' file on C: drive root
:: * Copy and paste following script in notepad and save it with any name having .cmd extension.
:: Batch Script Start

@Echo Off
SetLocal EnableDelayedExpansion

SET FilesPath=C:\TEST
IF NOT EXIST "%FilesPath%" Goto ShowErr
IF EXIST C:\RenameHistory.txt DEL /F /Q C:\RenameHistory.txt

FOR /R "%FilesPath%" %%F IN (*.*) Do (
      SET FDate=%%~tF
      SET MM=!FDate:~,2!
      SET DD=!FDate:~3,2!
      SET YYYY=!FDate:~6,4!
      SET Hrs=!FDate:~11,2!
      SET Min=!FDate:~14,2!
      SET AMPM=!FDate:~17,2!
      SET FDate=!MM!_!DD!_!YYYY!_!Hrs!_!Min!_!AMPM!%%~xF
      Echo Renaming: %%F
      Echo Renaming: %%F *WITH* !FDate! >>C:\RenameHistory.txt
      REN "%%F" !FDate!
)
Goto EndScript
:ShowErr
Echo '%FilesPath%' path/file does not exist!
:EndScript
ENDLOCAL
:: Batch Script End
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My previous article  (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/A_4466-A-beginners-guide-to-installing-SCCM2007-on-Windows-2008-R2-Server.html)detailed one possible method to get SCCM 2007 installed an…
Know what services you can and cannot, should and should not combine on your server.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question