aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.56k stars 578 forks source link

how to move file with spaces - try phantomjs fs module #1262

Closed pp082 closed 2 weeks ago

pp082 commented 2 years ago

Hi!!

I use run command to move file like the example. pathFile_ini and pathFile_fin are variables containing the full path.

pathFile_ini='/Users/useA/tagui/flows-M1Pro/RPA-Tagui/name with spaces .csv'
pathFile_fin='/Users/useA/tagui/flows-M1Pro/RPA-Tagui/files/ name_without_spaces .csv'
run mv `[pathFile_ini]` `[pathFile_fin]`

When the file download (pathFile_ini) contains spaces in the name, the move don´t work.

for this reasons i need change name the filename.

I need run the next command but the execution is stuck

run for f in * ; do mv "$f" "${f// /_}" ; done
echo 2 `[run_result]`

thats is worked on terminal, but I when put in the tagui command dosen't worked and got stuck for f in * ; do mv "$f" "${f// /-}" ; done

Tagui is a exceptional tools. Thanks in advance

ruthtxh commented 2 years ago

Hi @pp082 You can try using phantomjs fs module. https://phantomjs.org/api/fs/method/move.html The following worked for me:

var fs = require('fs');
fs.move("C:/Users/abc/A.txt", "C:/Users/abc/test folder/A.txt");

You can also rename the file in the destination using the above syntax.

kensoh commented 2 years ago

Thanks @pp082 for positive feedback! Alternatively, you can create a bash shell script with your commands and logic, then use TagUI run step on your shell script. The run step can't replicate exactly complex shell script commands because it is meant more for calling a particular command, rather than chaining complex commands. That would be done better in shell scripts or Windows batch files, then invoke using the run step.

pp082 commented 2 years ago

You have all reason with that

Maybe Python is better :)

for now I will try use this https://github.com/kelaberetiv/TagUI/issues/1262#issuecomment-1193456556 with a variable

pathFile_ini='/Users/useA/tagui/flows-M1Pro/RPA-Tagui/name with spaces .csv'
pathFile_fin='/Users/useA/tagui/flows-M1Pro/RPA-Tagui/files/ name_without_spaces .csv'

Thanks a lot !!! :)

kensoh commented 2 weeks ago

Closing but please ping back if this is still relevant or an issue.