lssp

Package: WA2L/WinTools 1.2.08
Section: General Commands (1)
Updated: 10 April 2020
Index Return to Main Contents

 

NAME

lssp - list the files on a Sharepoint™ site

 

SYNOPSIS

lssp [ -h | -V ]

lssp [ -b ] [ -l | -a | -p | -lp ] -s site -f folder

 

AVAILABILITY

WA2L/WinTools

 

DESCRIPTION

With lssp you can list the files of a Microsoft Sharepoint™ site from command line.

The columns are separated by a tabluator character.

 

OPTIONS

-h
usage message

-V
print program version.

-b
encode returned filenames or URLs to be used as hyperlinks.

-l
long output.

This listing includes the modification date of the file and the filename.

-a
all output.

This listing includes the file size in bytes, the modification date of the and the filename.

-p
list files with full absolute path (URL).

-lp
combination of the options -l and -p.

Therefore the firsts column is the modification time and the 2nd column is the file name with full absolute path (URL).

-s site
Sharepoint™ site, as: https://sharepoint.acme.ch/workgroups/reporting

The site can also be specified in the %LSSP_SITE% environment variable. However, the command line option has preference over the setting in the environment variable.

-f folder
folder on the site, as: Shared Documents/Capacity/Storage/ or Freigegebene Dokumente/Kapazitaet/Speicher/ .

If the folder is terminated by a / (=slash) all files in the folder are listed.

If the folder does not terminate by a / (=slash) the part from the last slash to the end of the specification is a regular expression that allows selecting specific file(s).

The folder can also be specified in the %LSSP_FOLDER% environment variable. However, the command line option has preference over the setting in the environment variable.

See also EXAMPLES section below.

 

ENVIRONMENT

%LSSP_SITE%
if this environment variable is set, the site must not be specified thru the -s site command line option.

%LSSP_FOLDER%
if this environment variable is set, the folder must not be specified thru the -f folder command line option.

 

EXIT STATUS

0
no error.

4
usage displayed.

5
version printed.

 

FILES

-

 

EXAMPLES

1) list all files in the folder

List all files in the folder Shared Documents/Report/Capacity Data/ on the http://share.acme.ch/workgroups/wg007 Sharepoint™ site:

lssp -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/"

2) list only files with July and August 2019 in the filename

Select only the files that have 07.2019 and 08.2019 in the file name:

lssp -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/.*0[7-8].2019"

3) list modification date of files

List files with the file modification time as first column and sort it ascending:

lssp -l ^
     -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/" ^
     | sort

4) list full path (URL) of last uploaded file

List full path (the full URL) of the files with the file modification time as first column, sort it ascending and output only the last (=the newest) file:

lssp -lp ^
     -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/" ^
     | sort | tail -1

5) download last uploaded file

List files with the file modification time as first column, sort it ascending, output only the last file and use the 2nd column (the full URL of the file) to download the source file and save it locally as newest.xlsx file:

lssp -lp ^
     -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/" ^
     | sort | tail -1 | cut -f2 ^
     | DownloadFile -s - -d newest.xlsx

6) download last uploaded file and preserve source filename

As example 5) but preserve source file name when downloading.

The downloaded source file will be saved in the directory downloads (which must exist):

mkdir downloads

lssp -lp ^
     -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/" ^
     | sort | tail -1 | cut -f2 ^
     | DownloadFile -s - -d downloads 

7) download last uploaded file and save file with a timestamp prefix

As example 5) but save source file with a timestamp prefix.

The timedat command is used to set a list of time and date related environment variables that can be used in scripts (batch files):

@echo off

setlocal enabledelayedexpansion

for /f "tokens=*" %%r in ('!WA2L_INSTALLDIR!\lib\timedat.exe') do %%r

mkdir downloads 2>nul

lssp -lp ^
     -s http://share.acme.ch/workgroups/wg007 ^
     -f "Shared Documents/Report/Capacity Data/" ^
     | sort | tail -1 | cut -f2 ^ 
     | DownloadFile -s - -d downloads\!Now!-Capacity-Report.xlsx

endlocal

 

SEE ALSO

wintoolsintro(1), lscomp(1), lscomp(1), llcomp(1), catcomp(1), console(1m), cut(1), downloadfile(1), tail(1), wtshell(1m)

 

BUGS

-

 

AUTHOR

lssp was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net .

 

COPYRIGHT

Copyright © 2020 Christian Walther

This is free software; see WA2LWinTools/man/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 16:32:18 GMT, September 14, 2024