Skip to main content
deleted 1 character in body
Source Link
Nasir Riley
  • 12.3k
  • 2
  • 26
  • 30

With find:

find . -maxdepth 1 -type f -name aaa\*.png -exec cp {} destination \;

. indicates the current directory.

-maxdepth 1 tells it to only look in the current directory

type -f tells it to look for files

-name aaa\*.png indicates files beginning with aaa and ending in .png

-exec cp {} destination \; copies the files into the directory called destination.

My environment requires me to escape the * with a \. Yours may not require this so you may be able to just use -aaa*.png

With find:

find . -maxdepth 1 -type f -name aaa\*.png -exec cp {} destination \;

. indicates the current directory.

-maxdepth 1 tells it to only look in the current directory

type -f tells it to look for files

-name aaa\*.png indicates files beginning with aaa and ending in .png

-exec cp {} destination \; copies the files into the directory called destination.

My environment requires me to escape the * with a \. Yours may not require this so you may be able to just use -aaa*.png

With find:

find . -maxdepth 1 -type f -name aaa\*.png -exec cp {} destination \;

. indicates the current directory.

-maxdepth 1 tells it to only look in the current directory

type -f tells it to look for files

-name aaa\*.png indicates files beginning with aaa and ending in .png

-exec cp {} destination \; copies the files into the directory called destination.

My environment requires me to escape the * with a \. Yours may not require this so you may be able to just use aaa*.png

Source Link
Nasir Riley
  • 12.3k
  • 2
  • 26
  • 30

With find:

find . -maxdepth 1 -type f -name aaa\*.png -exec cp {} destination \;

. indicates the current directory.

-maxdepth 1 tells it to only look in the current directory

type -f tells it to look for files

-name aaa\*.png indicates files beginning with aaa and ending in .png

-exec cp {} destination \; copies the files into the directory called destination.

My environment requires me to escape the * with a \. Yours may not require this so you may be able to just use -aaa*.png