Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement searching only in a specified folder #550

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Get a public share link for the specified file or directory
* **saveurl** <URL> <REMOTE_DIR>
Download a file from an URL to a Dropbox folder directly (the file is NOT downloaded locally)

* **search** <QUERY>
* **search** <QUERY> [REMOTE_DIR]
Search for a specific pattern on Dropbox and returns the list of matching files or directories

* **info**
Expand Down
10 changes: 6 additions & 4 deletions dropbox_uploader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1410,11 +1410,12 @@ function get_Share
function db_search
{
local QUERY="$1"
local REMOTE_DIRECTORY=$(normalize_path "$2")

print " > Searching for \"$QUERY\"... "
print " > Searching for \"$QUERY\"... in \"$REMOTE_DIRECTORY\" "

ensure_accesstoken
$CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"\",\"query\": \"$QUERY\",\"start\": 0,\"max_results\": 1000,\"mode\": \"filename\"}" "$API_SEARCH_URL" 2> /dev/null
$CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$REMOTE_DIRECTORY\",\"query\": \"$QUERY\",\"start\": 0,\"max_results\": 1000,\"mode\": \"filename\"}" "$API_SEARCH_URL" 2> /dev/null
check_http_response

#Check
Expand Down Expand Up @@ -1768,9 +1769,10 @@ case $COMMAND in
usage
fi

QUERY=$ARG1
QUERY="$ARG1"
REMOTE_DIRECTORY="$ARG2"

db_search "$QUERY"
db_search "$QUERY" "/$REMOTE_DIRECTORY"

;;

Expand Down