Help > Azure > blob >
put
PreviousNext

  • Overview
  • Syntax
  • Arguments
  • Notes
  • Examples
  • Overview

    uploads local file(s) to cloud storage

    Download ZappyShell

    Syntax

    put <SOURCE> [<TARGET>] [--header NAME_VALUE] [--meta KEY_VALUE]
               [--content-type VALUE] [--content-encoding VALUE]
               [--content-disposition VALUE] [--content-type-auto] [--expires VALUE]
               [--del INPUT] [--mov INPUT] [--mov-folder FOLDER_PATH] [--sync]
               [--setdate] [--struct] [-y|--overwrite] [-s|--skip] [-l|--fail]
               [-p|--prompt] [--crfol] [--exclude-olderthan INPUT]
               [--exclude-newerthan INPUT] [-r|--recursive] [-c|--continue-onerror]
               [--auth NAME] [--accesskey YOUR_ACCESS_KEY]
               [--secretkey YOUR_SECRET_KEY] [--serviceurl URL] [--threads COUNT]
               [--consoleout FILEPATH] [-v|--verbose] [-w|--wait] [-i|--interactive] 
    
    Alias: up, upload
    

    Arguments

    Parameter Description
    <SOURCE>
    Source file(s) you want to upload
    <TARGET>
    Target location where you want save uploaded file
    --header NAME_VALUE
    Additional http header(s) for target cloud storage file in Key=Value (e.g. Cache-Control:max-age=180;Content-Encoding:gzip)
    --meta
    Custom Metadata value in KEY=VALUE format (e.g. OWNER=bob). If you have multiple key value metadata pairs then use multiple command line switches (e.g. --meta dept=HR --meta owner=bob).
    --content-type VALUE
    User defined content-type you want to set for target file(s) after transfer (e.g. e.g. --content-type text\xml). This option instructs browser and other calling application how to open requested file.
    --content-encoding VALUE
    User defined content-encoding you want to set for target file(s) after transfer (e.g. --content-encoding gzip). Most common use of this option is to specify gzip encoding for compressed content. This is the way to instruct browser and web server that we are dealing with compressed content.
    --content-disposition VALUE
    User defined content-disposition you want to set for target file(s) after transfer (e.g. --content-disposition "attachment;filename=myfile.txt" ). This option controls how browser prompts for download file vs displaying content inline
    --content-type-auto
    Automatically determine best match for content type based on file extension. This option is ignored if you specify --content-type option
    --expires VALUE
    Specifies when content expires (HTTP cache-control header). You may enter days or exact datetime when content expires. Valid format specifiers are s,m,h,d (Examples: --expires 2015-12-31 (exact date), --expires 5d (after 5 days), --expires 24h (after 24 hours), --expires 60s (after 60 seconds), --expires 10m (after 10 minutes))
    --del
    Delete source file(s) after successful transfer
    --mov
    Move source file(s) to archive folder after successful transfer
    --mov-folder FOLDER_PATH
    Folder path where you want to move source file(s) after successful transfer. This option only applicable if you specified --mov option. You can timestmp your archive folder path with predefined placeholders (e.g. --mov-folder c:\archive\Load_{{YYYY}}_{{MM}}_{{DD}}). Valid placeholders are [{{DD}},{{MM}},{{MON}},{{YY}},{{YYYY}},{{HH}},{{HH12}},{{HH24}},{{MI}},{{SS}},{{MS}},{{US}},{{DATAROOT}}]
    --sync
    Synchronize source files with target. Files are compared based on size and LastWriteDateUtc if both attributes same in source and target then file is skipped.
    --setdate
    Sets the target file's last-modified time to be the same as the source file's LastModifiedDate after upload or download. When target file is cloud storage file then this option sets Metadata entry rather than setting actual LastModifiedDate because storage file LastModifiedDate attribute is readonly and cannot be changed.
    --struct
    Transfer files along with folder structure. Automatically create missing folders at target location. When you specify this option no need to specify recursive option because its always recursive scan when --struct option specified.
    -y | --overwrite
    Overwrite target file(s) if exists
    -s | --skip
    Skip file transfer and continue with other files
    -l | --fail
    Throw error if target file exists
    -p | --prompt
    Prompt for action if target file exists
    --crfol
    Automatically create missing target folder
    --exclude-olderthan
    Exclude files if they are older than specified period. You may use format specifier or exact date/datetime. Period format specifiers are d,h,m or s (days, hours, minutes or seconds). Example: 5d = (5 days), 5h=(5 hours), 5m=(5 hours), 5s=5s=(5 second), "2015-12-31 11:59:59"=(exact date+time), "2015-12-31"=(exact date)
    --exclude-newerthan
    Exclude files if they are newer than specified period. You may use format specifier or exact date/datetime. Period format specifiers are d,h,m or s (days, hours, minutes or seconds). Example: 5d = (5 days), 5h=(5 hours), 5m=(5 hours), 5s=5s=(5 second), "2015-12-31 11:59:59"=(exact date+time), "2015-12-31"=(exact date)
    -r | --recursive
    Scan recursive
    -c | --continue-onerror
    Continue on error such as specified file is missing at source
    --auth NAME
    Credential entry name. This entry name must exist (previously saved using setauth command)
    --accesskey YOUR_ACCESS_KEY
    Cloud account access key
    --secretkey YOUR_SECRET_KEY
    Cloud account secret key
    --serviceurl URL
    Service url for cloud service e.g. --serviceurl https://s3-us-west-2.amazonaws.com
    --threads COUNT
    Number of concurrent operations. If you don't specify then system will use default settings to optimize transfer.
    --consoleout FILEPATH
    Captures console output and saves to file
    -v | --verbose
    Log verbosity level. -v means detailed, If you don't specify this option then minimum logging will be done.
    -w | --wait
    Wait for user input before exit
    -i | --interactive
    Continue in interactive mode after this command is completed. This switch is not applicable if you already in interactive mode

    Notes

    Examples

    Examples
    Upload single file to azure blob storage

    put "c:\localfolder1\file1.txt" "mycontainer/folder2/" 
    Upload single file to azure blob storage and give new name

    put "c:\localfolder1\file1.txt" "mycontainer/folder2/newname_file1.txt" 
    Upload multiple files to azure blob storage

    put "c:\localfolder1\file*.*" "mycontainer/folder2"
    Upload multiple files with always overwite option ON (-y). Scan recursive (-r) and upload files from sub folders too.

    put "c:\localfolder1\file*.*" "mycontainer/folder2" -y -r
    Upload full folder structure to target.

    put "c:\localfolder1\" "mycontainer/folder2" --struct -r
    Sync entire folder structure. Upload source file only if its newer than target file(--sync). Retain folder structure of source to target (--struct)

    put "c:\data\" mycontainer --struct -sync
    Upload local files modified in last 5 days

    put "c:\data\" mycontainer --exclude-olderthan 5d
    Upload local files modified in last 10 hours

    put "c:\data\" mycontainer --exclude-olderthan 10h
    Upload local files modified in last 30 minutes

    put "c:\data\" mycontainer --exclude-olderthan 30m
    Upload local files modified after 2010-12-31 (just date without time)

    put "c:\data\" mycontainer --exclude-olderthan 2010-12-31"
    Upload local files modified after 2010-12-31 15:56:59 (date and time)

    put "c:\data\" mycontainer --exclude-olderthan "2010-12-31 15:56:59"
    Upload local files to cloud storage and once transferred delete from source (--del option). Overwrite target file (-y option)

    put "c:\data\*.txt" mycontainer --del -y
    Upload local files to cloud storage and once transferred move source file to some archive folder (--mov and --mov-folder options). Automatically create archive folder with current timestamp in YYYYMMDD format

    put "c:\data\*.txt" mycontainer --mov --mov-folder "c:\archive\process_{{YYYY}}{{MM}}{{DD}}"
    Upload local files to cloud storage and automatically set correct content type

    put "c:\data\*.txt" mycontainer --content-type-auto
    Upload local files to cloud storage and set expration date to 5 days from now, set some custom metadata and set content type to text\plain for text files being uploaded

    put "c:\data\*.txt" --content-type text\plain --expires 5d --meta "owner=bob" --meta "department=HR"


    www.zappysys.com | Products | All copyrights reserved. ZappySys LLC.