How to use wildcards to copy specific files in nested dirs?

Advertisement

rinuxguy
Guest

How to use wildcards to copy specific files in nested dirs?

Let's say I want to use the WinSCP GUI to copy only the files that end in .png or .jpg from a folder called image. So basically I want to drag over the image folder and only copy those files.

The image folders contains many folders nested deep inside it, so I want WinSCP to recursively search all those nested directories for my file types as well. I want it to copy over those .png and .jpg files and place them in the same folder structure they were found in.

How can I do this using the WinSCP GUI? Thanks!

Reply with quote

Advertisement

rinuxguy
Guest

Re: How to use wildcards to copy specific files in nested dirs?

Thanks for the tip. I'm using 4.x. I tried "*/; *.jpg; *.png" and it is copying the entire subfolders over rather than just the jpg and png files located inside those nested folders. I believe since the directory mask */ is specified, it's just copying over the whole directory over.

How do I make it so it goings through those nested directories but only copies jpg and png files only in those directories?

martin wrote:

Depends on version of WinSCP you are using.
With 4.x, you need to use: */; *.jpg; *.png
With 5.x beta, it is enough to use: *.jpg; *.png
See https://winscp.net/eng/docs/file_mask
Also with 5.x you can use file mask editor:
https://winscp.net/eng/docs/ui_editmask

Reply with quote

rinuxguy
Guest

Re: How to use wildcards to copy specific files in nested dirs?

One other note, I tried the 5.x beta and the mask you specified but it didn't apply the file mask to the subfolders, it was only applied to the current folder.

Reply with quote

rinuxguy
Guest

I got it now, please ignore my previous replies. I tried the 5.x beta, right clicked on the folder I wanted to copy, chose Copy, click on Transfer settings, then clicked on the Edit button in File Mask. From there I entered the files I wanted. It works great!

Reply with quote

Advertisement

You can post new topics in this forum