Replace files via ssh
Hello there.
Today we installed a test server with ubuntu. we have a medical system running that holds test data. We want to schedule a tast clearing the test data. so far we managed to create a cron job, but we have trouble figure out the command for overwriting the data. that the test data is located in many different foldes we need to use a command the takes all sub dirs on the disk we tried : cp -Rf newdata.001 *.gmf "newdata.001" is our fresh data file and *.gmf is the old test files. how can we solve this? |
are you trying to move the data from server A to server B?
If so then I encourage you to look up rsync as that is exactly what it is for. if you are just trying to remove data from server B at set times you can create a simple script that scrubs those directories and sub directories as long as they are doing to be the same name. instead of cp, you might want to try mv. |
no not at all
We like to replace (overwrite) all *.gmf with the newdata.001 file |
Maybe sometime like the following:
Code:
find $datadir -name "*.gmf" -exec cp /path/to/newdata.001 {} \; Also, I'm trying not to sound rude here, but if you plan to be developing or deploying a medical records system on Linux, you really ought to have someone (be it in house or an outside consultant) that understands the platform. At least here in the USA there are all sorts of regulations like HIPPAA for systems like these, and while it doesn't matter much in a test environment with fake data, it will matter if these systems are deployed with real patient data on them. Security considerations and back-ups become highly important. Somebody on the team needs to understand these requirements and have enough Linux skills to ensure that they're met. |
^^This^^
Also, you can't replace *.xyz files with *.123 files. Won't work. It would be easiest to run 2 seperate commands... rm -rf *.xyz cp -rf newfile.001 |
Quote:
|
Ok guys thanks for the answers.
I think from this new knowledge I can refrase my question. The case is that the *.gmf files just needs to be overwriten with a zerobyte file (witch we created as a "newdata.001" file) 1. we can not remove (delete) all *.gmf files that they are placed in different datafolders with specific names that the system depends on. So my question is, can I somehow make all gmf files on the entire disk written as zerobyte files (clear the files) I was searching on google and found out that maybe the files could be truncated, could this work : > *.gmf |
still not really understanding. maybe something like:
Code:
find /whatever/floats/your/boat -type f -name "*.gmf" -exec echo > '{}' \; |
ok after a fast google search, it appears the .gmf file extension is some kind of image from some special software. in that case a mv would most likely be best in combination with the find command.
Code:
DOW=`date +%A` |
All times are GMT -5. The time now is 08:47 AM. |