英文:
Download files from all remote subdirectories to one local directory with WinSCP script file
问题
这将获取所有mp4
和mkv
文件到K:\in
,但也会保留它们在源驱动器上的子目录。我想要最终在K:\in
中只有mp4
和mkv
文件,没有子目录。
最终我想要的是:
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论