TagUI icon indicating copy to clipboard operation
TagUI copied to clipboard

how to move file with spaces - try phantomjs fs module

Open pp082 opened this issue 3 years ago • 3 comments

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

pp082 avatar Jul 24 '22 02:07 pp082

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.

ruthtxh avatar Jul 25 '22 01:07 ruthtxh

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.

kensoh avatar Jul 30 '22 08:07 kensoh

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 !!! :)

pp082 avatar Aug 01 '22 03:08 pp082