Regularly upload file _ 1 to FTP on the arm Board

Source: Internet
Author: User

Now, the project must create a new folder for the file to be uploaded, and upload the file to this folder with the name of the current time, one of the key points is that if you create a folder for a remote host, the command for creating a folder is mkdir xmphoenix. But how can you get the time?

#! /Bin/bash

B = $ (date + % Y-% m-% d)

Cat B

This simple step shows the value of parameter B.

# A is the current date
A = $ (date + "% Y % m % d ")
# B is the 8 days before the current date
B = $ (date-d "8 days ago" + "% Y % m % d ")

Obtain the current period:

'Date + % Y % m % d' or 'date + % F' or $ (date + % Y % m % d) Get the period of yesterday:

'Date-d Yesterday + % Y % m % d'

Get date of the day before yesterday: 'date-D-2day + % Y % m % d'

And so on, for example, get the date 10 days ago:

'Date-D-10day + % Y % m % d'

'Date-d "n days ago" + % Y % m % d' n days ago'

Tomorrow: 'date-d tomorrow + % Y % m % d' note that there are spaces in the middle

Time Domain

% H hour (00 .. 23) % I hour (01 .. 12) % K hour (0 .. 23) % L hour (1 .. 12) % m (00 .. 59)

% P displays am or PM % R time (HH: mm: SS am or pm)

12 hours % s the number of seconds that have elapsed since January 1, 1970 00:00:00

% S seconds (00 .. 59)

% T time (in 24-hour format) (HH: mm: SS)

% X display time format (% H: % m: % s)

% Z Time Zone Date Field

% A abbreviation of the day of the week (Sun... Sat )...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.