Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Writting batch Files  (Read 2962 times)

0 Members and 1 Guest are viewing this topic.

b14_rebel

  • Guest
Writting batch Files
« on: May 25, 2007, 01:43:45 PM »
I have wrote a batch file to download files from a ftp site and save them to a folder.
Now I would like to rename them in another folder and add the date to them, Can You Help?

Computer Hope Admin

  • Administrator


  • Prodigy

    Thanked: 248
    • Yes
    • Yes
    • Yes
    • Computer Hope
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 10
Re: Writting batch Files
« Reply #1 on: May 25, 2007, 02:14:22 PM »
You should be able to simply rename the file using the rename command. See the below link or help and information regarding the rename command.

http://www.computerhope.com/renamehl.htm

I'm not sure about adding the date to a file or modifying the date of a file through a batch file. Unless you were to modify each of the files, then the OS would automatically change the date.

Moving this topic to the MS-DOS section as it's likely you'll get much more assistance there.
Everybody is a genius. But, if you judge a fish by its ability to climb a tree, it will spend its whole life believing that it is stupid.
-Albert Einstein

GuruGary



    Adviser
    Re: Writting batch Files
    « Reply #2 on: May 25, 2007, 03:34:30 PM »
    What OS are you running?  Under Windows 2000 / XP / 2003 / Vista, you can loop through the files in your batch file and assuming the filename is %%a in your FOR /F loop, and your date format of %date% is U.S. English, you can rename them like:
    Code: [Select]
    ren "%%a" "%%~na%date:~-4%%date:~-10,2%%date:~-7,2%%%~xa"

    b14_rebel

    • Guest
    Re: Writting batch Files
    « Reply #3 on: May 26, 2007, 05:29:32 AM »
    I am running Windows XP Pro

    b14_rebel

    • Guest
    Re: Writting batch Files
    « Reply #4 on: May 26, 2007, 05:57:38 AM »
    I beleive tha works

    burchill

    • Guest
    Re: Writting batch Files
    « Reply #5 on: October 11, 2007, 02:29:24 PM »
    Can you send me your code that downloads files from ftp sites?  i have tried to create my own code but I don't know how :( 
    Thank you

    dos nerd

    • Guest
    Re: Writting batch Files
    « Reply #6 on: October 18, 2007, 12:38:16 AM »
    You haven't put that much detail into this question but if i am rite you should use this command:

    (AT)

        Fom ?????