bsharath
asked on
Rename all files in the folder to the created date
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
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
ASKER
Windows 2003 OS
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
Chris
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
Chris
:: ================
:: 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!_!Hr s!_!Min!_! AMPM!.!Fil eExt!
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
:: 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!_!Hr
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
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
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
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Chris