Search code examples
linuxrenamesftpmove

SFTP move files within remote dir


I need to move files between remote directories. It will always be multiple files and there is no naming convention to work with. Is there any way to use the rename command with a wildcard?

For example:

rename /dir1/dir2/* /dir1/dir2/history/

This does not work, it returns the following error:

Couldn't rename file "/dir1/dir2/*" to "/dir1/dir2/history": No such file or directory

Suggestions are highly appreciated.


Solution

  • I don't know rename, is this a SFTP command?

    Anyway, you don't have to use SFTP. You can use SSH like this:

    ssh user@fqdn "mv /dir1/dir2/* /dir1/dir2/history/"