Copy/compare folder

Advertisement

Prince
Guest

Copy/compare folder

Sub folder question
Hi

I have read a lot of post but I think this my request nobody ask to this forum for a possible solution.
This is my request if possible. I have this scenario:

c:\example

in this folder I have this subfolder

c:\example\carl\- 01 -
c:\example\richard\- 02 -
c:\example\helena\- 03 -
c:\example\stephan\- 02 -
c:\example\morgan\- 04 -
c:\example\mary\ - 03 -

I need to create a script for compare/copy only folder with subfolder "- 02 -"
Final result will be:

c:\example\richard\- 02 -
c:\example\stephan\- 02 -

The other folder name must be exclude

Is this possible?

Thanks for an help

Prince

Reply with quote

Advertisement

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

Re: Copy/compare folder

Prince wrote:

I need to create a script for compare/copy only folder with subfolder "- 02 -"
Final result will be:

c:\example\richard\- 02 -
c:\example\stephan\- 02 -

The other folder name must be exclude
That's sound ambiguous to me.

Do you want to
- copy only folder with subfolder "- 02 -"
- or copy only the subfolder "- 02 -"

Or are these the same, i.e. is there always only one subfolder?

Reply with quote

Guest

Re: Copy/compare folder

martin wrote:

Prince wrote:

I need to create a script for compare/copy only folder with subfolder "- 02 -"
Final result will be:

c:\example\richard\- 02 -
c:\example\stephan\- 02 -

The other folder name must be exclude
That's sound ambiguous to me.

Do you want to
- copy only folder with subfolder "- 02 -"
- or copy only the subfolder "- 02 -"

Or are these the same, i.e. is there always only one subfolder?

Need to copy folder (and file into it) with subfolder (and file into it)

Reply with quote

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

Re: Copy/compare folder

There's no magic way to implement such special task.

You have to write a script that identifies the folders you are looking for.

It is easy e.g. with PowerShell and WinSCP .NET assembly.
https://winscp.net/eng/docs/library_powershell

Use:
- Session.ListDirectory to enumerate all folders
- Session.FileExists to check an existence of the - 02 - subfolder
- Session.GetFiles to download them

https://winscp.net/eng/docs/library_session_listdirectory
https://winscp.net/eng/docs/library_session_fileexists
https://winscp.net/eng/docs/library_session_getfiles

Reply with quote

Advertisement

You can post new topics in this forum