Find the answer to your Linux question:
Results 1 to 8 of 8
I've surfed & surfed & can't find something that helps me out on this one. I'm creating a zip file but I need the file name to look like FilenameMMDDYY.zip ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    3

    Creating File with Today's date

    I've surfed & surfed & can't find something that helps me out on this one.
    I'm creating a zip file but I need the file name to look like
    FilenameMMDDYY.zip -
    How do I append today's date onto the file name?

    Thanks

    gina

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,095
    Welcome to the forums!

    Can't you just right-click the file and rename it that?
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    3
    Ugh minor detail I forgot - actually I'm creating this file in a shell script that's running weekly which then is ftp'ing to another server.
    I've got it all working except the naming piece since the person getting the data needs the files identified in such a way he knows which company is transmitting the data.
    Thus I'm zipping 5 files into 1 to automatically ftp over.

    So it's within a shell script that I need to do this vs manually right clicking (which does work but doesn't accomplish what I need automatically)

    gina

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Code:
    mv filename filename$(date +%m%d%y)
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    3
    Bingo! Thank a lot - my guess' were sort of close but would never have gotten there.

    - gina

  6. #6
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Glad to help you.
    Do post back if you have any other query.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    2

    FileName with data

    Hi

    filename like xxx_sep13_2007

    gzip xxx_sep13_2007


    Thanks and Regards

    senthil k

  8. #8
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Quote Originally Posted by senthil_linux View Post
    Hi

    filename like xxx_sep13_2007

    gzip xxx_sep13_2007
    Code:
    gzip xxx_$(date "+%b%d_%Y" | tr A-Z a-z)
    date --help will give you a list of all possible formats you can print.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...