[英]bash - Copy and rename file to higher directory, to new file type
I am still learning bash, but this should be easy. 我仍在学习bash,但这应该很容易。 I want to copy a file from a temp folder to a higher directory, and change the name. 我想将文件从临时文件夹复制到更高的目录,然后更改名称。
home/temp/oldfile
to home/newfile.txt
home/temp/oldfile
到home/newfile.txt
oldfile
has no specific file type, and it's name is adjusted on a daily basis. oldfile
没有特定的文件类型,并且它的名称每天都会调整。 So, I would like to copy whichever file is in home/temp
and paste it as .txt. 因此,我想复制home/temp
任何文件并将其粘贴为.txt。 The temp folder contains only 1 file. 临时文件夹仅包含1个文件。
Command so far 到目前为止的命令
cp /home/temp/. /home/newfile.txt -R
I then get the error cp: omitting diretory '/home/temp/.'
然后,我得到错误cp: omitting diretory '/home/temp/.'
Any ideas? 有任何想法吗? Thanks. 谢谢。
you should replace .
您应该更换.
with *
: 带*
:
cp /home/temp/* /home/newfile.txt
no need for the -R
option; 不需要-R
选项; since you are copying only one file. 因为您只复制一个文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.