Hi everyone,
I'm using the files_search() function in a Python script to look at the names of files in my app's folder and based on those names, the script will perform certain functions. The script also changes the names of some files using files_move(). I've noticed that when I use files_move() to change filenames, files_search() will sometimes return incorrect results. Here's the sort of thing I'm doing:
- Have a file called 'printmessage=1' in Dropbox (no file extension)
- Use files_search() from the Python API in a loop (repeats every 10 seconds) to look for a file with 'printmessage' in its name, and extract the number after the '=' sign.
- If the number after the '=' is 1, print a message with Python and then use files_move() to change it back to 0.
- Repeat
Sometimes, after files_move() has changed the filename back to 'printmessage=0', files_search() still thinks it is 'printmessage=1'. I have checked in Dropbox and the filename is definitely 'printmessage=0'.
I'm not sure what the root of this issue could be - is there any reason why files_search() might not reflect the true contents of my Dropbox folder? Where is it getting its information from when it returns incorrect filenames?
Thanks for the help 