upload from multiple local directory to 1 remote directory

Advertisement

alexanderlim
Joined:
Posts:
1
Location:
134

upload from multiple local directory to 1 remote directory

Hi all,

I am not sure whether this is possible to do. I would like to upload only picture files from multiple local direcotyr into 1 remote directory. For example:

on local, I have:
c:\mypicture\2001\
c:\mypicture\2002\
c:\mypicture\2003\
c:\mypicture\2004\

Inside 2001, 2002, 2003, 2004 I have all my picture files.

I want to upload all those picture files into 1 remote directory. I have created a ftp login account that will login to the remote directory that I want to upload those picture files to.

So far this is what I have but it does not seems to work.

"C:\Program Files\WinSCP\WinSCP.exe" /script="C:\ftp_auto.txt"

ftp_auto.txt:

open test
option batch on
option confirm off
option include *.bmp;*.jpg;*.gif;*.png
synchronize remote "c:\mypicture\*\" "/"
exit

After upload, the remote directory should have:
picture1.jpg
picture2.jpg
picture3.jpg
picture4.jpg

No subdirectories under this directory should be created. Meaning that I do not want to have:
2001\picture1.jpg
2001\picture2.jpg
2002\picture3.jpg
2002\picture4.jpg

If inside directory 2001 and 2002 contain files with the same name, then only the latest one should be copied to the remote directory.

Any help would be greatly appreciated.

Thanks.

Regards,
AL

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: upload from multiple local directory to 1 remote directory

You cannot do this with just WinSCP script. You have to create script in some scripting language that creates WinSCP script to do the task.

Reply with quote

Guest

Re: upload from multiple local directory to 1 remote directory

martin wrote:

You cannot do this with just WinSCP script. You have to create script in some scripting language that creates WinSCP script to do the task.

Do you mean write a script that will recursively loop through every picture subdirectories and then upload each file?

Reply with quote

martin
Site Admin
martin avatar

Re: upload from multiple local directory to 1 remote directory

Anonymous wrote:

Do you mean write a script that will recursively loop through every picture subdirectories and then upload each file?
Something like that. You do not need to upload every file separately, just every directory.

Reply with quote

Advertisement

You can post new topics in this forum