Results 1 to 5 of 5

Thread: Script insert date in the name of my file

  1. #1
    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


    @ 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.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    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 /?

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    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

  4. #4
    Join Date
    Apr 2008
    Posts
    1,948

    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 *

  5. #5
    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

Similar Threads

  1. How to insert automatic date in a website
    By Patrickboy in forum Software Development
    Replies: 8
    Last Post: 04-05-2012, 10:49 AM
  2. How to insert last date in excel 2010
    By Calum in forum Windows Software
    Replies: 5
    Last Post: 18-02-2010, 12:07 AM
  3. Insert date format in SQL via ASP
    By Bansi_WADIA in forum Software Development
    Replies: 4
    Last Post: 04-12-2009, 10:56 PM
  4. Script to insert new line in a file in linux
    By OSzilla in forum Operating Systems
    Replies: 3
    Last Post: 28-07-2009, 11:48 PM
  5. Script to insert IP camera on web page
    By huzmat in forum Software Development
    Replies: 3
    Last Post: 04-05-2009, 03:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,265,383.50253 seconds with 17 queries