Como eu uso 'cp -R' para copiar todos os arquivos para uma subpasta sem copiar a subpasta também?

0

Eu tenho uma pasta de imagens que estou tentando copiar em uma subpasta dele mesmo, para que eu possa redimensionar as imagens.

Parece algo assim:

Sephs-MacBook-Pro:photos seph$ ls
100x100                                 image1.png
image2.png                              image3.png
image4.png                              pic1.jpg

O problema que eu tenho é quando eu executo a função Sephs-MacBook-Pro:photos seph$ cp -R ./. 100x100 Eu recebo um erro, que basicamente diz que eu não posso continuar adicionando 100x100 pastas para eles mesmos:

cp: 100x100/./100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/100x100/.DS_Store: name too long (not copied)

Como uso o cp -R para copiar arquivos para uma subpasta sem copiar a subpasta?

    
por Seph Reed 31.12.2017 / 06:46

1 resposta

1

Usando cp ./*.* ./100x100 sem , a opção -R copiará todos os arquivos do diretório para o subdiretório 100x100 sem copiar o diretório para si mesmo.

A opção -R é para copiar recursivamente todos os subdiretórios para o destino e não deve ser usada se você não quiser que isso aconteça.

Veja man cp para mais informações sobre as opções do comando e o que elas fazem.

    
por 31.12.2017 / 07:53

Tags