Topic "Filemask errror"

Author Message
Help please

Guest


Hello I am trying to write a automatic script to open a server and find all the file names that start with AAA within a folder(called "loading" that has over 100 subfolders that start from "load 1" to "load 100"). I am trying to use the filemask option to find these files and copy them to my local directory of C:\Users\Documents\filetransfer.

So far i have
"C:\Program Files (x86)\WinSCP\WinSCP.com" /command ^
"option batch abort" ^
"option confirm off" ^
"open sftp://Username:Password@server.com/" ^
"cd "/app/manager/loading/"" ^
"get -filemask=*AAA C:\Users\Documents\filetransfer\"^
"exit"

Does anybody know what is wrong with this or how do you get certain files from a folder with a lot of sub folders? I have read all the links of documents but still cant seem to figure it out.

Thanks for your time
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Quote:
start with AAA

That would be AAA*, not *AAA.
Help please

Guest


Okay thank you, would that still search all the sub folders in the folder "loading" ? Or would I have to add a certain syntax so it searches all the subfolders inside the folder "loading"
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
It will search all subfolders.
help please

Guest


When entered the code with corrected
Quote:
AAA*

I recieve an error saying
Quote:
Can't get attributed of file 'C:\Users\Documents\filetransfer\'.
No such file or directory.
error code: 2
error message from server: No such file

It seems like it is trying to get the file of C:\Users\Documents\filetransfer\ instead of using that folder as teh destination to transfer all the files name "AAA". Do you know what is wrong ? Sorry i will donate also Very Happy
Help please

Guest


Okay i have figured it out ! but when It copys the files it also copies the folders along with the files. Is there anyway I could just get the files, instead of the files in subfolders? here is my current code
Quote:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /command ^
"option batch abort" ^
"option confirm off" ^
"open sftp://Username:Password@server.com/" ^
"lcd C:\Users\Documents\filetransfer\ ^
"get -filemask=AAA.txt* /app/manager/loading/"^
"exit"


thanks once again
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Help please wrote:
Okay i have figured it out ! but when It copys the files it also copies the folders along with the files. Is there anyway I could just get the files, instead of the files in subfolders?

-filemask=AAA.txt*|*/

See http://winscp.net/eng/docs/faq_script_non_recursive
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License