ForFiles Loop

Discussion in 'LiquidFiles General' started by LRSpartan, Jun 8, 2019.

  1. LRSpartan

    LRSpartan New Member

    Joined:
    Apr 30, 2019
    Messages:
    13
    Likes Received:
    2
    Below is a simple M$FT command for looping over all files in a directory and having curl uploading them to your LF server. I am very new to CURL and LF, but needed a way to upload all files in a directory to LF.
    This is pretty basic and runs from a .bat file.

    ***
    forfiles /p C:\curl\curl-7.64.1-win64-mingw\bin\testupload /c "C:\curl\curl-7.64.1-win64-mingw\bin\curl.exe -H -o POST --user PlaceAPIKeyHere:x -F file=\"@@path\" https://some.lf.server/shares/internal-documents/folders/root/files" >>LOG-curlloop.html
    ***

    Directory to loop over: C:\curl\curl-7.64.1-win64-mingw\bin\testupload
    Standard curl command with forefiles variables: "C:\curl\curl-7.64.1-win64-mingw\bin\curl.exe -H -o POST --user PlaceAPIKeyHere:x -F file=\"@@path\" https://some.lf.server/shares/internal-documents/folders/root/files"

    For .bat file, you will need to add an extra @ for variable names. So @path becomes @@path.

    Hopefully someone will find this helpful and would appreciate learning what others are doing.
     

Share This Page