How to limit "move" command

Advertisement

MrBedo
Joined:
Posts:
1

How to limit "move" command

I am trying to move some remote folders into a remote archive. The issue here is I need to exclude certain folders. From what I have read and what I have tried, it seems there's no easy way to exclude folders when using the move command.
Specifying the folders to move by name isn't an option as they are random and change each day.

So I have a bunch of root folders:

RandomFolder A
RandomFolder B
RandomFolder C
Archive 1
Archive 2

How can I move all the RandomFolders into Archive 1 and leave Archive 2 where it is?

I have read around but can't seem to find a definitive answer. There was talk of adding exclusion options to the mv command some time ago, but that seems not to have happened yet.

Thanks

Reply with quote

Advertisement

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

Re: How to limit "move" command

If the folders you want to move have anything in common (like RandomFolder prefix), you can use a file mask:
mv /RandomFolder* /destination/path

If not, you can write a code in your favourite language with use of WinSCP .NET assembly and its Session.EnumerateRemoteFiles (or Session.ListDirectory) and Session.MoveFile methods.
https://winscp.net/eng/docs/library_session_enumerateremotefiles
https://winscp.net/eng/docs/library_session_movefile

Here is a example that you can start with:
https://winscp.net/eng/docs/library_example_advanced_rename

Reply with quote

firekid
Joined:
Posts:
3

sorry to bump old topic. i am new user and i don't have any permission to create a new topic.
i made a small command line script which is downloading file/folder to my local hard disk.
now i want to move those files and folder from my local hdd to another local hdd

mv "D:\Dl\*" "E:\Dl\complete"
also tried
mv "D:\Dl*.*" "E:\Dl\complete"

i getting error
no file matching "D:\Dl*.*" found.

any help please?

Reply with quote

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

firekid wrote:

sorry to bump old topic. i am new user and i don't have any permission to create a new topic.
i made a small command line script which is downloading file/folder to my local hard disk.
now i want to move those files and folder from my local hdd to another local hdd
You cannot use WinSCP scripting to move local files to another local folder. That's not what WinSCP scripting is for.

Reply with quote

Advertisement

You can post new topics in this forum