Download files from all remote subdirectories to one local directory with WinSCP script file.

huangapple go评论52阅读模式
英文:

Download files from all remote subdirectories to one local directory with WinSCP script file

问题

这将获取所有mp4mkv文件到K:\in,但也会保留它们在源驱动器上的子目录。我想要最终在K:\in中只有mp4mkv文件,没有子目录。

最终我想要的是:

K:\in.mkv
K:\in.mkv
K:\in.mkv

感谢您的时间。

英文:

This gets all the mp4 and mkv files into K:\in, but it also preserves the subdirectories they were in on the source drive. I want to end up with mp4 and mkv files in K:\in without the subdirectors.

I end up with this in K:\in

K:\in.mkv
K:\in\abc.mkv
K:\in\def.mkv

and I want to end up with this

K:\in.mkv
K:\in.mkv
K:\in.mkv

Appreciate your time

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\Users\MediaServer\Desktop\winscp.log" /ini=nul ^
  /command "open sftp://%SFTP_USER%:%SFTP_PASSWORD%@%SFTP_HOST% -hostkey=""%HOSTKEY%""" ^
     "cd /home3/cam4/" ^
	 "lcd K:/in"^
	 "get -filemask=*.mp4;*.mkv *"^

答案1

得分: 1

"It's not possible with simple WinSCP scripting.

But if you switch to WinSCP .NET assembly, you can implement it easily.
See WinSCP example for downloading all files from FTP/SFTP to the same local folder.


Alternatively, keep your download script and flatten the downloaded directory structure ex-post locally.

for /r "c:\downloadpath" %%f in (".") do move "%%f" "c:\targetpath"

(also covered in the link above)"

英文:

It's not possible with simple WinSCP scripting.

But if you switch to WinSCP .NET assembly, you can implement it easily.
See WinSCP example for downloading all files from FTP/SFTP to the same local folder.


Alternatively, keep your download script and flatten the downloaded directory structure ex-post locally.

for /r "c:\downloadpath" %%f in ("*.*") do move "%%f" "c:\targetpath\"

(also covered in the link above)

huangapple
  • 本文由 发表于 2023年5月7日 04:57:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76191108.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定