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

Sponsored Links



Script insert date in the name of my file

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 31-10-2008
Member
 
Join Date: Jul 2006
Posts: 289
Script insert date in the name of my file
  

Hello,
Here is the 1st time I try to create a script to run on Windows my script is designed to take a file the Zipper after the end rename and copy it to another folder

Infact we all generally works well but is a small concern is that in one part of my name I must insert the current date and then it freezes !!!!!!
what I try to do me


Quote:
@ echo off
set dat=%date% set dat = date%%
cd C: \ Documents and Settings \ karimcherif \ Desktop
rar a-m0 "C: \ Documents and Settings \ karimcherif \ Desktop \ Folder1 \ Folder1" "Folder1"

cd C: \ Documents and Settings \ karimcherif \ Desktop \ Folder1

ren Folder1 * CIT8550L00_3680_010_001_%% _B1220I dat-APZ *


Copy / y "C: \ Documents and Settings \ karimcherif \ Desktop \ Folder1 \ CIT8550L00_3680_010_001_%% _B1220I dat-apz.rar" "C: \ Documents and Settings \ karimcherif \ Desktop \ File2"

but it does not work, so if you have any other ideas to insert date in the filename ?

still one last issue I want to know is that it is possible to run my script automatically at a specific hour every day?

thank you in advance for your help.

Reply With Quote
  #2  
Old 31-10-2008
Member
 
Join Date: Apr 2008
Posts: 1,946
Re: Script insert date in the name of my file

It depends on what format you want to find your date
eg for YYYY-MM-DD, you do
set dat =% date: ~ 7.4% -% date: ~ 4.2% -% date: ~ 1.2%

for details: set /?
Reply With Quote
  #3  
Old 31-10-2008
Member
 
Join Date: May 2008
Posts: 2,004
Re: Script insert date in the name of my file

No, but with the "/" It is true that for a file name that is not: for the coup, it seeks to create a folder: D
Reply With Quote
  #4  
Old 31-10-2008
Member
 
Join Date: Apr 2008
Posts: 1,946
Re: Script insert date in the name of my file

ren Folder1 * CIT8550L00_3680_010_001_%% _B1220I dat-APZ *

I do not know if it is a facet of the Slashdot editor, but there is a space before and after dat%% And since there was no quotation marks around the string, rename must be difficult to navigate.

To detail closely with the%% dat defined above
ren File1* CIT8550L00_3680_010_001_%dat%_B1220I-apz* ren Folder1 * CIT8550L00_3680_010_001_%% _B1220I dat-APZ *

will result in
ren Filer1* CIT8550L00_3680_010_001_2008-10-29_B1220I-apz* ren Folder1 * CIT8550L00_3680_010_001_2008-10-29_B1220I-APZ *
Reply With Quote
  #5  
Old 31-10-2008
Member
 
Join Date: Jul 2006
Posts: 289
Re: Script insert date in the name of my file

Thank you very much it helped me. In fact the problem was the / so it had to be removed from the date.


thank you once again
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Script insert date in the name of my file"
Thread Thread Starter Forum Replies Last Post
How to insert automatic date in a website Patrickboy Software Development 8 04-05-2012 10:49 AM
How to insert last date in excel 2010 Calum Windows Software 5 17-02-2010 11:07 PM
Insert date format in SQL via ASP Bansi_WADIA Software Development 4 04-12-2009 09:56 PM
Script to insert new line in a file in linux OSzilla Operating Systems 3 28-07-2009 11:48 PM
Script to insert IP camera on web page huzmat Software Development 3 04-05-2009 03:57 PM


All times are GMT +5.5. The time now is 02:52 PM.