I use a shell script that takes a single directory, called NewData
, with wha开发者_如何转开发tever is inside of it, and creates this:
There is one step I want to add, and I am not sure how to do it. I want to move the contents of NewData
and NewDataCopy
into their respective parent directories (ProtectedOrig
and Data
) and delete NewData
and NewDataCopy
. What command(s) would I add to my script to do this without specifically naming the files to be moved (they will be different every time I run the script)?
If it would help, you can have a look at the script here. I'm grateful for whatever assistance I can get!
You can move everything without naming the files specifically by using a "glob" (aka a "wildcard"). That's a *
.
So let's say you are in DataDirectory
. You can move everything from Data/NewDataCopy
up to Data
by doing this: mv Data/NewDataCopy/* Data/
. Then delete with a rmdir Data/NewDataCopy
.
Starting from DataDirectory
then to do everything you'd do this:
mv Data/NewDataCopy/* Data/
rmdir Data/NewDataCopy
mv ProtectedOrig/NewData/* ProtectedOrig/
rmdir ProtectedOrig/NewData
精彩评论