Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Append Date-Time while Renaming files

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 20-11-2009
Member
 
Join Date: Jan 2009
Posts: 61
Append Date-Time while Renaming files
  

Hi, I want to append date and time to file which I am renaming. How to do it? I have tried following bat file, but not working as I want.
Code:
FOR %%V IN (%1) DO FOR /F "tokens=1-5 delims=/: " %%J IN ("%%~tV") 
DO ECHO Rename "%%V" %%L%%J%%K_%%M%%N%%~xV
Can you help me to do it?

Reply With Quote
  #2  
Old 20-11-2009
Member
 
Join Date: Apr 2008
Posts: 3,263
Re: Append Date-Time while Renaming files

Hello, I am using one bat file which first make zip of the file and then rename it in mmddyy format. Just try it.

Code:
set mm= %Date:~3,2%
set dd = %Date:~0,2%
set yy = %Date:~8,2%
pkzip -a AL%mm%dd%yy% *.doc
I think this will solve your problem. Just try this.
Reply With Quote
  #3  
Old 20-11-2009
Member
 
Join Date: Apr 2008
Posts: 3,516
Re: Append Date-Time while Renaming files

Hello, I have got one bite script which will work for you. Just use it. It will help you in this situation.

For getting time stamp:
Code:
var str timestamp
set $timestamp=gettime()
For getting file extension
Code:
var str extension
stex "[^.^l"$ $file >$extn
Now for adding timestamp to the file name:
Code:
set $file = $file + $timestamp
Again to add extension
Code:
set $file = $file + $extension
Reply With Quote
  #4  
Old 20-11-2009
Member
 
Join Date: Apr 2008
Posts: 3,290
Re: Append Date-Time while Renaming files

Hi, I have got the code which will append date and time while renaming it. Just try to make use of it, if you are getting it. I am not able to know how to use it? But if you got it, then reply me also.

Code:
Set date=%date:~10,4%%date:~4,2%%date:~7,2%
FOR %%V IN (%1) DO Call :DoLoop

:DoLoop
set OFullFileName=%%V
Set OFileExt=%FileName:~-4%
Set OFileName=%OFullFileName:~0,-4%
Set NFullFileName=%OFileName%%dat%%OFileExt%
Rename %OFullFileName% %NFullFileName%
Goto :EOF
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Append Date-Time while Renaming files"
Thread Thread Starter Forum Replies Last Post
error message: cant login This computer date/time is not synchornize with the date/time of network fazalhassan Networking & Security 2 29-11-2011 08:29 AM
Need to append a sequential number to a date field in access $Jaganmohini$ Windows Software 4 04-02-2011 06:39 PM
How can I append video files in powerpoint slides ? Naotau Windows Software 3 26-11-2010 03:22 AM
Renaming files in Linux Aileen_L Operating Systems 5 16-02-2010 03:27 PM
Renaming Music Files - working with ITunes Data Files Tahseen Shahzad Windows XP Support 2 01-08-2009 12:54 AM


All times are GMT +5.5. The time now is 09:05 PM.