Move multiple files to different directory using a single command

I have multiple files test1, test2, test3 etc. I want to move to a different directory with ABC_ prefixed to every file and and current dat time as postfix using a single command. (I will be using this is sftp with ! (command for local server).

I have tried the following but it gives error


cp * /other_dir/ABC_{*}_`date +%m%d%y`

With a classic for loop:

for f in *; do cp "$f" /other_dir/ABC_"$f"_`date +%m%d%y`; done
1 Like

Thanks. In fact I wanted a single command, but this will work for me

I think only mmv can do it with one command.

mmv -c "*" /other_dir/ABC_"#1"_`date +%m%d%y`

Is the rename (perl?) utility available at your target host?

RudiC,

perl is available. Not rename UNIX command.