help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

copy


From: Val Krem
Subject: copy
Date: Tue, 20 Jul 2021 21:38:20 +0000 (UTC)

Hi all,

In one folder I  have list of  several  files. Based on a condition (grep) I 
want pick the latest  file from all files  and and copy this file  to somehwere.

Here is my  sample  of the zipped files and my attempt
Sample  files
    AB1_2002.csv
    AB1_2003.csv
    AB1_2008.csv
    AB2_2005.csv

I used this,

 ll | grep -e  AB1 |tail -1
the result is
    AB1_2008.csv

How do I copy this file to this folder?

"c:\data\AB1"  folder

my attempt

ll | grep -e  AB1 |tail -1  -exec bash -c 'cp "$1" c:\data\AB1

did not work.

Any help?

Thank you,







reply via email to

[Prev in Thread] Current Thread [Next in Thread]